Skip to content
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

Auth set session manually #135

Closed

Conversation

powerful23
Copy link
Contributor

No description provided.

js/authentication.md Outdated Show resolved Hide resolved
idToken: 'xxxxxxx', // Optional, the id token
accessToken: 'xxxxxxx', // Optional, the access token
refreshToken: 'xxxxxxx', // Optional, the refresh token
expires_at: 1540857110755, // Required, the timestamp when the token expires
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you provide two tokens, which expires_at is this for?

Copy link
Contributor Author

@powerful23 powerful23 Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format has been changed. The expires_at would be the session expiration timestamp which is determined by the user.

refreshToken: 'xxxxxxx', // Optional, the refresh token
expires_at: 1540857110755, // Required, the timestamp when the token expires
},
provider: AWSCognitoProvider.NAME, // Required, the name of the token provider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to make this provider generic for more than just Cognito

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWSCognitoProvider Does not exist?!
my aws-amplify: 1.1.17

Copy link
Contributor

@undefobj undefobj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments per our discussion on a new session concept. Let's integrate into the v2 design doc.

@frankmuellr frankmuellr added the amplify/js Issues tied to JS label Dec 6, 2018
@svetozar02
Copy link

svetozar02 commented Jan 16, 2019

Any updates on this PR? We really need it. Not being able to user social login on react native is painful

@RyanRTS
Copy link

RyanRTS commented Jan 16, 2019

Also looking for an update on this, it would really help us out

@JohnBRTS
Copy link

Any progress/updates on this PR? This would be a significant help in a problem we're currently dealing with in our app

@DavidvanZyl
Copy link

Any news on this?

@undefobj
Copy link
Contributor

undefobj commented Mar 4, 2019

@DavidvanZyl @JohnBRTS @RyanRTS @svetozar02 we reviewed all of the feedback for this PR and related issues, and believe we can actually provide a more comprehensive solution. Could you please look at the following comment: aws-amplify/amplify-js#825 (comment) and related PR & RFC to see if this will meet your needs? If not could you let us know why you still might require this solution? Thanks.

@DavidvanZyl
Copy link

Looks like #2716 would do the job for me. My current issue is timing. I can get auth with the JS SDK and I could get caching etc with AppSync/Amplify if only I could get the two to work together. Or (more topically) get federated login in my Ionic/Angular app with the latter, rendering the prior unnecessary. @undefobj For my sanities sake please, as things stand, is it possible for me to make my own UI and have users log in anon and convert to authenticated with a social login and have the caching ability?

@undefobj
Copy link
Contributor

undefobj commented Mar 4, 2019

@DavidvanZyl sounds like you're looking for something different than this PR, which is offline caching of data from AppSync and using it Authenticated and UnAuthenticated flows. Am I misinterpreting that? If that's the case I would suggest looking at this issue and the linked sample repo: aws-amplify/amplify-js#2363 (comment)

@DavidvanZyl
Copy link

@undefobj It's my understanding that an amplify api will automatically handle caching data from requests? But thats kind of beyond the point of this I guess (I just hoped you might have a solution and save me from this 'mare) The problem as I've seen it from my looking around and trying various solutions is that: While using amplify, federated login does not work. I have therefore, tried to make use of the SDK to provide Auth alongside Amplify but there seems to be no way to integrate the two. Which is what this PR is about so far as Ive understood it. I cant get the data returned by the SDK in terms of IdentityId and AccessId into Amplify Auth to create a session which leaves me with a 'No user' style of error. Ideally Amplify would let me use social logins, or at least let me create a session with data from the SDK so that I can use the api that amplify creates when you use the CLI (which again, I believe does caching). Does that make sense or am have I totally misunderstood something?

@undefobj
Copy link
Contributor

undefobj commented Mar 5, 2019

@DavidvanZyl

@undefobj It's my understanding that an amplify api will automatically handle caching data from requests?

If by caching in the API category you mean for offline support, etc., then yes this is provided by the AppSync SDK for the Apollo client which is part of the "umbrella" Amplify framework. Please see the documentation here: https://aws-amplify.github.io/docs/js/api#aws-appsync-sdk

While using amplify, federated login does not work. I have therefore, tried to make use of the SDK to provide Auth alongside Amplify but there seems to be no way to integrate the two. Which is what this PR is about so far as Ive understood it. I cant get the data returned by the SDK in terms of IdentityId and AccessId into Amplify Auth to create a session which leaves me with a 'No user' style of error. Ideally Amplify would let me use social logins, or at least let me create a session with data from the SDK so that I can use the api that amplify creates when you use the CLI (which again, I believe does caching). Does that make sense or am have I totally misunderstood something?

I think there are a couple of things to tease out here. First, "Auth" is a category inside of Amplify which is comprised of libraries, CLI, toolchain, and UI components. What you are referencing above if the Auth.federatedSignIn() API of the Auth category in the library. I'm not sure where you're no user error is coming from, but I have a feeling you might be confusing IAM-based authorization on the API category (hence why you're looking at federatedSignIn and a Cognito Identity ID). This is all supported and functional today and unrelated to this PR. The current PR is for manually setting a session which many customers were looking to do as there was no Hosted UI federation capabilities with React Native, which per my other link is coming soon. I would suggest opening up a new issue with your use case and details of what you're trying to build so that someone from our oncall could address as you might be chasing something unnecessary here.

@stale
Copy link

stale bot commented Jul 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jul 13, 2019

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

@stale stale bot closed this Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants