updateResourceServer method
Updates the name and scopes of a resource server. All other fields are read-only. For more information about resource servers, see Access control with resource servers.
Learn more
- Signing Amazon Web Services API Requests
- Using the Amazon Cognito user pools API and user pool endpoints
May throw InternalErrorException.
May throw InvalidParameterException.
May throw NotAuthorizedException.
May throw OperationNotEnabledException.
May throw ResourceNotFoundException.
May throw TooManyRequestsException.
Parameter identifier :
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 like
https://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.
Parameter name :
The updated name of the resource server.
Parameter userPoolId :
The ID of the user pool that contains the resource server that you want to
update.
Parameter scopes :
An array of updated custom scope names and descriptions that you want to
associate with your resource server.
Implementation
Future<UpdateResourceServerResponse> updateResourceServer({
required String identifier,
required String name,
required String userPoolId,
List<ResourceServerScopeType>? scopes,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.UpdateResourceServer'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Identifier': identifier,
'Name': name,
'UserPoolId': userPoolId,
if (scopes != null) 'Scopes': scopes,
},
);
return UpdateResourceServerResponse.fromJson(jsonResponse.body);
}