-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose OAuth class through Auth module #8933
Comments
+1 This would be useful in cases where you need to setup SAML federated access |
+1 Setting up SAML Federated access and am working on this exact issue right now. |
+1 SAML federated scenarios |
1 similar comment
+1 SAML federated scenarios |
Need for some micro UI SSR scenario's (so basically a federated setup I think) |
Hi @jglesner - I want to make sure I am understanding your use case properly - you are using federatedSignIn, but then need to create a user session which produces the id, access, refresh token sessions programmatically as part of that flow? |
@abdallahshaban557 In my particular case, I'm using federatedSignIn in a pop-up browser window within a JS mobile app, and once complete, I have the Cognito URL. I want public access to the Auth class so that I can process it. So I need a programmatic alternative to Using the |
Hi @jglesner -and for your particular use case using the AWS credentials is not enough to access resources you might need? you need to create a session and retrieve all the tokens you get with userpool sign in? |
@abdallahshaban557 no, this isn’t so I can log in. this is a mobile app backed by cognito designed to let users of the app create accounts. As I explained, I don’t need the tokens as much as I need to process a cognito url and create an Amplify cognito user session. |
@abdallahshaban557 Has there been any update on this? From what I can see, @jglesner proposed solution is the best option as of now and none of us love using a private function. In my opinion, the best option would be leaving Amplify out of the solution and adding |
@saconnolly - we do not have an update yet. Thank you for that suggestion, however we are not making update to the |
Is this related to a new or existing framework?
No response
Is this related to a new or existing API?
No response
Is this related to another service?
No response
Describe the feature you'd like to request
In issue #8632, I highlighted the fact that there is limited documentation/support to programmatically create a user session using Cognito (id, access, refresh) tokens. In the solution I provided to my own question, I am using a private method in the Auth module: _oAuthHandler. My approach bypasses the compile time checking, since this method is marked private, which isn't a good long-term solution.
I use the _oAuthHandler method for access to the OAuth class, which has the handleAuthResponse method to conveniently process a cognito response url. I use this method to process the cognito response url directly because (1) I retrieve the response url from an in app browser window (which the native urlListener can't do), and (2) there is limited third party package support for deep linking to handle out of app redirects. Therefore, I would like to see (a) the _oAuthHandler method made public, or (b) the OAuth class (or the OAuth.handleAuthResponse method) made accessible through Auth or the aws-amplify package.
While it is possible for someone to write their own RESTful method to process the cognito response url, what's the point of doing that when the AWS Amplify package exists?
Describe the solution you'd like
I would like the _oAuthHandler method to be made public so that I can access the OAuth class without having to bypass the fact tha the _oAuthHandler is currently private, and so that I/others know that this method will be supported into the future.
If _oAuthHandler is made public, you would want to drop the _ at the front. And I would use it like so:
The cognito user session can be picked up by Amplify using the second part of my solution.
Describe alternatives you've considered
The alternative is to make a REST call to the Cognito API, or bypass compile time checking, which isn't a good solution.
Additional context
No response
Is this something that you'd be interested in working on?
The text was updated successfully, but these errors were encountered: