createTokenWithIam

Creates and returns access and refresh tokens for clients and applications that are authenticated using IAM entities. The access token can be used to fetch short-term credentials for the assigned AWS accounts or to access application APIs using bearer authentication.

Samples


fun main() { 
   //sampleStart 
   val resp = ssoOidcClient.createTokenWithIam {
    clientId = "arn:aws:sso::123456789012:application/ssoins-111111111111/apl-222222222222"
    grantType = "authorization_code"
    code = "yJraWQiOiJrZXktMTU2Njk2ODA4OCIsImFsZyI6IkhTMzg0In0EXAMPLEAUTHCODE"
    redirectUri = "https://mywebapp.example/redirect"
    scope = listOf<String>(
        "openid",
        "aws",
        "sts:identity_context"
    )
} 
   //sampleEnd
}