UserPoolCredentialProvider - How to access tokens #27
-
Hello, I am looking to make use of the UserPoolCredentialProvider functionality to facilitate authentication client side. I understand how to configure the UserPoolCredential provider and instantiate the AWSClient with the .cognitouserpool identity, but what I'm unsure about is how I can access the token from the .cognitouserpool after instantiating the AWSClient. Looking to retrieve the ID Token, access token, and refresh token after the AWSClient has been setup. Any guidance is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The UserPoolCredentialProvider is used for providing AWS credentials via User Pools. It isn't really designed for providing access to the access, id and refresh tokens. Here would be an example usage where I use it to access an object stored on S3. let credentialProvider: CredentialProviderFactory = .cognitoUserPool(
userName: myName,
authentication: .password(myPassword),
...
)
let client = AWSClient(credentialProvider: credentialProvider, httpClientProvider: .createNew)
let s3 = S3(client: client, region: .euwest1)
let data = try await s3.getObject(.init(bucket: myBucket, key: myKey)) If you want access, id or refresh tokens then you should use |
Beta Was this translation helpful? Give feedback.
The UserPoolCredentialProvider is used for providing AWS credentials via User Pools. It isn't really designed for providing access to the access, id and refresh tokens. Here would be an example usage where I use it to access an object stored on S3.
If you want access, id or refresh tokens then you should use
CognitoAuthenticatable