AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Container for the parameters to the GetClientToken operation.
Issues an access token for machine-to-machine (M2M) authorization. Your app client
provides its client ID and secret, and receives an access token that authorizes requests
to your resource servers. GetClientToken provides the same functionality as
the OAuth2 client-credentials grant; both authorize an application rather than a user.
To use this operation, you must configure the app client with a client secret and
enable the ALLOW_CLIENT_TOKEN_AUTH authentication flow. The ALLOW_CLIENT_TOKEN_AUTH
flow is mutually exclusive with user authentication flows. It must be the only authentication
flow that you configure for the app client. For more information, see Scopes,
M2M, and resource servers.
Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
Namespace: Amazon.CognitoIdentityProvider.Model
Assembly: AWSSDK.CognitoIdentityProvider.dll
Version: 3.x.y.z
public class GetClientTokenRequest : AmazonCognitoIdentityProviderRequest IAmazonWebServiceRequest
The GetClientTokenRequest type exposes the following members
| Name | Description | |
|---|---|---|
|
GetClientTokenRequest() |
| Name | Type | Description | |
|---|---|---|---|
|
ClientId | System.String |
Gets and sets the property ClientId.
The ID of the app client that requests the access token. The app client must have
a client secret and the |
|
ClientMetadata | System.Collections.Generic.Dictionary<System.String, System.String> |
Gets and sets the property ClientMetadata. A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers. You create custom workflows by assigning Lambda functions to user pool triggers.
When Amazon Cognito invokes any of these functions, it passes a JSON payload, which
the function receives as input. This payload contains a To review the Lambda trigger types that Amazon Cognito invokes at runtime with API requests, see Connecting API actions to Lambda triggers in the Amazon Cognito Developer Guide.
When you use the
|
|
Scopes | System.Collections.Generic.List<System.String> |
Gets and sets the property Scopes.
The custom scopes to authorize in the access token, in the format |
|
Secret | System.String |
Gets and sets the property Secret. An active secret for the app client. |
The following example gets an access token for the app client 1example23456789 with the custom scope solar-system-data/asteroids.add.
var client = new AmazonCognitoIdentityProviderClient();
var response = client.GetClientToken(new GetClientTokenRequest
{
ClientId = "1example23456789",
Scopes = new List<string> {
"solar-system-data/asteroids.add"
},
Secret = "exampleClientSecret123EXAMPLE"
});
ClientAuthenticationResultType clientAuthenticationResult = response.ClientAuthenticationResult;
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer