fetchUserAttributes should use /oauth2/userInfo endpoint vs Cognito API call requiring aws.cognito.signin.user.admin scope #14148
Labels
pending-maintainer-response
Issue is pending a response from the Amplify team.
pending-triage
Issue is pending triage
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
None
Environment information
Describe the bug
The method
fetchUserAttributes
currently performs a Cognito SDK API call which therefore requires the scopeaws.cognito.signin.user.admin
This is unnecessary and imo not great security wise as the
aws.cognito.signin.user.admin
scope allows access to ANY control plane operation that accepts an Access TokenCognito has OAUTH endpoints that will return the same userprofile information at
/oauth2/UserInfo
this will return all user attributes the access token has access to - requiring only theprofile
scope and perhapsemail
andphone
scope depending on what attributes are needed to be retrieved.Expected behavior
Able to call
fetchUserAttributes
without setting the scopeaws.cognito.signin.user.admin
as that scope should not be required to just fetch user attributes.Reproduction steps
call
fetchUserAttributes
without the admin scope - see that the Cognito control plane API is hit vs the oauth APICode Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: