Skip to content
v2.274.0

UserPoolResourceServerOptions Struct ​

Options to create a UserPoolResourceServer.

Example ​

ts
const pool = new cognito.UserPool(this, 'Pool');

const readOnlyScope = new cognito.ResourceServerScope({ scopeName: 'read', scopeDescription: 'Read-only access' });
const fullAccessScope = new cognito.ResourceServerScope({ scopeName: '*', scopeDescription: 'Full access' });

const userServer = pool.addResourceServer('ResourceServer', {
  identifier: 'users',
  scopes: [ readOnlyScope, fullAccessScope ],
});

const readOnlyClient = pool.addClient('read-only-client', {
  // ...
  oAuth: {
    // ...
    scopes: [ cognito.OAuthScope.resourceServer(userServer, readOnlyScope) ],
  },
});

const fullAccessClient = pool.addClient('full-access-client', {
  // ...
  oAuth: {
    // ...
    scopes: [ cognito.OAuthScope.resourceServer(userServer, fullAccessScope) ],
  },
});

Properties ​

identifierstringidentifierstridentifierStringIdentifierstringIdentifier*stringrequired#
A unique resource server identifier for the resource server.
scopesoptionalResourceServerScope[]scopesoptionaltyping.List[ResourceServerScope]scopesoptionalList<ResourceServerScope>ScopesoptionalResourceServerScope[]Scopesoptional*[]ResourceServerScope#
Oauth scopes.

Default: No scopes will be added

userPoolResourceServerNameoptionalstringuser_pool_resource_server_nameoptionalstruserPoolResourceServerNameoptionalStringUserPoolResourceServerNameoptionalstringUserPoolResourceServerNameoptional*string#
A friendly name for the resource server.

Default: same as identifier