Description
Is this related to a new or existing framework?
React, Vue
Is this related to a new or existing API?
Authentication
Is this related to another service?
No response
Describe the feature you'd like to request
i want to have possibility to request security token issued by 3rd party OIDC provider from Amplify Auth js object. I need this for my browser based amplify app to be able to call OIDC provider API directly for its services. I use Amplify v.5 API now and my OIDC user signin is working fine, but I cannot enable user to access the provider's services after it. After OIDC flow initialization with
Auth.federatedSignIn({
customProvider: 'github',
options: {
scope: ['repo']
}
i get session object as below, but it has only idToken and accessToken issed by Cognito which cannot be used in https request to OIDC provider's API:
const handleAuthEvent = async (event, data) => {
if (['signIn', 'tokenRefresh', 'cognitoHostedUI', 'federatedSignIn'].includes(event)) {
const session = await Auth.currentSession({ bypassCache: true });
}
}
Does Amplify v.6 API support this use-case or not? Or maybe Gen2 API does?
Describe the solution you'd like
I want solution of this problem, ideally Auth object could provide method Auth.currentOidcToken()
. Or session, received as const session = await Auth.currentSession({ bypassCache: true });
could have an "oidc" property keeping that token.
Describe alternatives you've considered
alternative cases under consideration are:
- initiate oidc session with provider directly from the amplify app (without Cognito) - cons: no good as I have to store "security_key" in browser client
- create Lambda function (which has security_key) to initiate OIDC flow and return token - cons: this is not leveraging my OIDC provider setup mage in Cognito userPool and used for SignIn case, this is complex to implement, each function for each OIDC probably, security should be thought additinally.
Additional context
example of Amplify application, which needs such feature is a banking app or hosted git (github) app, where i want enable a user to login with one of its banks account (or git providers) and then, after being authenticated, allow the user to access some services like payments, history check (or repository creation and pushing files - in github case)
Is this something that you'd be interested in working on?
- 👋 I may be able to implement this feature request
-
⚠️ This feature might incur a breaking change