aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
237 stars 111 forks source link

[Feature Request] Add "setSignInUserSession" function #1486

Open fpabl0 opened 2 years ago

fpabl0 commented 2 years ago

Hello, in amplify-js there is a setSignInUserSession function that allow us to set session tokens without using the signIn function, is it possible to have this feature in Android too? Thanks.

Related to https://github.com/aws-amplify/amplify-flutter/issues/845.

raphkim commented 2 years ago

We will track this feature request in the backlog for native platforms (iOS + Android). We will prioritize it based on how much traction it receives.

uyt95 commented 2 years ago

Has there been any progress on this feature? We are developing an Android TV application with a similar use case as the Flutter app of fpabl0.

gpanshu commented 1 year ago

Hi @fpabl0 can you elaborate what your use case is and how you would achieve that without sign in? From what I understand you will need to sign in using either escape hatch or your own apis and then store the session parameters in amplify. This is not possible to do since we are now using a state machine architecture and all other apis depend on the sign in state machine to be in the signed in state. Is there a reason you are looking for authentication outside of the SDK?

gpanshu commented 1 year ago

Closing due to inactivity.

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

flodaniel commented 1 year ago

Hi @gpanshu , I am jumping in as @fpabl0 is not responding and we are also interested to have this implemented. In our project we initially started without using amplify and handling user authentication through our own backend. So credentials would be passed from our (flutter) app to our backend and from there we used the amazon-cognito-identity-js package to handle authentication.

As we expanded our team and moved from the MVP phase to an actual producted we started using amplify. Because we cannot migrate the existing/logged in users to the frontend amplify SDK, we pretty much only use the provided escape hatches and do tons of manual REST requests to the AWS infrastructure (e.g. for storage). If we could "silently" sign in our already authenticated users we could fully migrate to the amplify SDK.

I hope this explains the reasoning behind this feature request, but I am happy to explain in more detail if necessary.

gpanshu commented 1 year ago

Hi @flodaniel feel free to create a PR contribution to our repository and we would evaluate its pros and cons to have such a feature available. In the meantime I am going to re-open this issue and track it as a feature request. Thank you.

pm-nchain commented 4 months ago

Based on my weird usecase, setting session manually could be useful. I don't know the specifics, but we had to do some work around in order for WeChat login to work for us.

We POST WeChat login code to our BE, and they create user account on Cognito side, and return user data (token, refreshToken, idToken, etc.). And I had to use that data, to manage user session.

I guess our BE could make this easier for me, but that's the hole I'm in :slightly_smiling_face: