1

Actually I have 2 questions. I added google, facebook and twitter sign in to my android app. I use firebase sign in for register and login. After that I will use my own python server. Now, I want to add auto sign in. Namely, after first login, it won't show login page again and it will open other pages automatically. I searched but i didn't find a sample for this structure. How can I do auto sign in with facebook, google, twitter in my android app. And how my server know this login is success and it will give user's data to clients in securely.

wowo
  • 173
  • 3
  • 11

2 Answers2

0

You need to do a web-service call from Android side just after login from firebase, stating in your server that this user has logged in to your app. You can store the access token provided by firebase or you can generate yours on web service call and thereby authenticate user with that token for user specific pages.

Kruti Parekh
  • 1,271
  • 9
  • 21
0

When the user first logged in you need to save a Boolean shared preference states that the user is already logged in every time you need to check if the user is logged in before showing the login screen.

  public void saveIsLoggedIn(Context context, Boolean isLoggedIn){
    mContext = context;
    sharedPreferences = mContext.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
    SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.putBoolean ("IS_LOGGED_IN", isLoggedIn);
    editor.commit();

}

public boolean getISLoggedIN() {
    //mContext = context;
    sharedPreferences = mContext.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
    return sharedPreferences.getBoolean("IS_LOGGED_IN", false);

}

Melad
  • 1,184
  • 14
  • 18
  • Thanks for that but this side is okey. I will use token for securty so when user open app, I need to take data with sign in every time on server. I can't comunicate with server with this. – wowo Jul 15 '18 at 14:00