CognitoIdentityProvider / Client / create_resource_server
create_resource_server#
- CognitoIdentityProvider.Client.create_resource_server(**kwargs)#
Creates a new OAuth2.0 resource server and defines custom scopes within it. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers.
Note
Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.
Learn more
See also: AWS API Documentation
Request Syntax
response = client.create_resource_server( UserPoolId='string', Identifier='string', Name='string', Scopes=[ { 'ScopeName': 'string', 'ScopeDescription': 'string' }, ] )
- Parameters:
UserPoolId (string) –
[REQUIRED]
The ID of the user pool where you want to create a resource server.
Identifier (string) –
[REQUIRED]
A unique resource server identifier for the resource server. The identifier can be an API friendly name like
solar-system-data
. You can also set an API URL likehttps://solar-system-data-api.example.com
as your identifier.Amazon Cognito represents scopes in the access token in the format
$resource-server-identifier/$scope
. Longer scope-identifier strings increase the size of your access tokens.Name (string) –
[REQUIRED]
A friendly name for the resource server.
Scopes (list) –
A list of custom scopes. Each scope is a key-value map with the keys
ScopeName
andScopeDescription
. The name of a custom scope is a combination ofScopeName
and the resource serverName
in this request, for exampleMyResourceServerName/MyScopeName
.(dict) –
One custom scope associated with a user pool resource server. This data type is a member of
ResourceServerScopeType
. For more information, see Scopes, M2M, and API authorization with resource servers.This data type is a request parameter of CreateResourceServer and a response parameter of DescribeResourceServer.
ScopeName (string) – [REQUIRED]
The name of the scope. Amazon Cognito renders custom scopes in the format
resourceServerIdentifier/ScopeName
. For example, if this parameter isexampleScope
in the resource server with the identifierexampleResourceServer
, you request and receive the scopeexampleResourceServer/exampleScope
.ScopeDescription (string) – [REQUIRED]
A friendly description of a custom scope.
- Return type:
dict
- Returns:
Response Syntax
{ 'ResourceServer': { 'UserPoolId': 'string', 'Identifier': 'string', 'Name': 'string', 'Scopes': [ { 'ScopeName': 'string', 'ScopeDescription': 'string' }, ] } }
Response Structure
(dict) –
ResourceServer (dict) –
The details of the new resource server.
UserPoolId (string) –
The ID of the user pool that contains the resource server configuration.
Identifier (string) –
A unique resource server identifier for the resource server. The identifier can be an API friendly name like
solar-system-data
. You can also set an API URL likehttps://solar-system-data-api.example.com
as your identifier.Amazon Cognito represents scopes in the access token in the format
$resource-server-identifier/$scope
. Longer scope-identifier strings increase the size of your access tokens.Name (string) –
The name of the resource server.
Scopes (list) –
A list of scopes that are defined for the resource server.
(dict) –
One custom scope associated with a user pool resource server. This data type is a member of
ResourceServerScopeType
. For more information, see Scopes, M2M, and API authorization with resource servers.This data type is a request parameter of CreateResourceServer and a response parameter of DescribeResourceServer.
ScopeName (string) –
The name of the scope. Amazon Cognito renders custom scopes in the format
resourceServerIdentifier/ScopeName
. For example, if this parameter isexampleScope
in the resource server with the identifierexampleResourceServer
, you request and receive the scopeexampleResourceServer/exampleScope
.ScopeDescription (string) –
A friendly description of a custom scope.
Exceptions
CognitoIdentityProvider.Client.exceptions.InvalidParameterException
CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
CognitoIdentityProvider.Client.exceptions.LimitExceededException
CognitoIdentityProvider.Client.exceptions.InternalErrorException