Closed altibanna closed 2 years ago
I haven't try to use it w/o UserPool. Please search through https://github.com/aws-amplify/amplify-js issues. JS package has a significantly bigger community, and if it is possible there, we can do it in the current package as well.
Also you can rise an issue here as well - https://github.com/aws-amplify/amplify-flutter
So this is how I do it with the React Native libs
import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-identity";
import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
const awsRegion = 'us-east-1';
const cognitoIdPoolID = "us-east-1:my-id-pool-id";
async function buildApolloClient(accessToken) {
return await fromCognitoIdentityPool({
client: new CognitoIdentityClient({ region: awsRegion }),
identityPoolId: cognitoIdPoolID,
logins: { ['mydomain.us.auth0.com']: accessToken }
})()
.then((creds) => {
The access token is from a successful Auth0 login earlier in the flow. No user pool required. Creds is then populated with the correct access and secret keys etc.
I see. JS libs imports fromCognitoIdentityPool
from aws-sdk
(https://github.com/aws/aws-sdk-js-v3/blob/main/packages/credential-provider-cognito-identity/src/fromCognitoIdentityPool.ts)
Unfortunately, we don't have the fromCognitoIdentityPool
method in the package.
You are welcome to contribute if you wish.
Forgive me if this is obvious but, I can't see a way to use the getAwsCredentials method without specifying a CognitoUserPool. My application just uses an IdentityPool with OAuth configured with Auth0 - which is managing my users. How can i specify getting credentials without also specifying a user pool and just provide the access token and login domain ?