I'm trying to use AWS Cognito via the OAuth2 scheme and cannot for the life of me figure it out. My configuration...
strategies: {
dev: {
_scheme: 'oauth2',
authorization_endpoint: 'https://<cognito domain>.auth.<cognito region>.amazoncognito.com/oauth2/authorize',
userinfo_endpoint: 'https://<cognito domain>.auth.<cognito region>.amazoncognito.com/oauth2/token',
scope: ['openid', 'profile', 'email', 'phone'],
response_type: 'token',
token_type: 'Bearer',
client_id: '<cognito client ID>',
token_key: 'access_token',
grant_type: 'authorization_code',
endpoints: {
user: {
method: 'post'
}
}
}
}
Current flow...
/callback/ route/my-account/ route/my-account/ route attempts to call https://<cognito domain>.auth.<cognito region>.amazoncognito.com/oauth2/token, which returns 400a) The call is made as GET call, not a POST call
b) The body is missing all of the required parameters for that endpoint per Amazon's documentation
Before I go off and write my own plug-in, has anyone managed to get AWS Cognito working with this module? If so, is this something that could be added as a predefined scheme?
Why was this closed? I would also vote for a feature request to include AWS Cognito as a provider that is predefined like Auth0 etc
I was able to get it to work by changing the userinfo_endpoint to /userInfo instead of /token so the configuration would look something like:
strategies: {
dev: {
_scheme: 'oauth2',
authorization_endpoint: 'https://<cognito domain>.auth.<cognito region>.amazoncognito.com/oauth2/authorize',
userinfo_endpoint: 'https://<cognito domain>.auth.<cognito region>.amazoncognito.com/oauth2/userInfo',
scope: ['openid', 'profile', 'email', 'phone'],
response_type: 'token',
token_type: 'Bearer',
client_id: '<cognito client ID>',
token_key: 'access_token'
}
}
Its been over a year, is this still the best way to integrate Cognito and Nuxt Auth?
Most helpful comment
Why was this closed? I would also vote for a feature request to include AWS Cognito as a provider that is predefined like Auth0 etc