Share data between two android applications


Hi, i am working on two different projects. I want to login from one app and save the login token. When user want to use second app, then instead of login again by providing email and password from second app. He should login by using the token generated by first app. Is there some available for this scenario.


You need to declare the same android:sharedUserId in both applications and sign them with the same key, at which point they should be able to read one another’s data.


in general you should not do it…
never ever share auth token or sessions.

Maybe you should not provide two apps and merge both functionalities in one.


@bengtler, it is a client requirement. User have to login from one application and use that login token on other app to use the app.


yeah but then you need to store the token somewhere persistent, which is a high security issue.
I would build something like deeplinking. After login in the first app --> provide a link to open the second app and there you pass the token, which is used in the second app


@bengtler Actually, the ioS has a mechanism of storing data in keychain, I am looking similar thing. And i cannot give the link to the second app in first. because it is up to the user if he want to use the second app or not.


then use

to check if the app is installed, and then show a button “SSO for app XXX”.

Then you have a clear workflow und a single mechanism to share the token


@bengtler I can not do this, because client does not want this. I have to share token, when the user login from first app and when user use the second app, he will access the token there. for this scenario is there anything available?


write the token in a file and access the file. you should be able because they share the userId (like @rapropos) guided you