I have an app which do the canonical email/password login and signup to the server.
Note: I need to do the login / auto-login every time the user open the app.
Now I want to add login/signup with fb.
Currently I'm using the android Account manager with a custom authenticator where I save mail and password. If a user log in with fb I will not have any password to save in the account: I have to save something else instead or I'll leave that field empty? In the latter if I'll add another auth system as Twitter how can I know to which system the user belong?
Speaking about the server, which data I'll have to send to it to authenticate Fb users? I thought about the couple email/id, but it doesn't seem too strong to me...
Thank you for your time
Best How To :
how can I know to which system the user belong
Use SharedPreferences in order to save which system the user belong to:
public static int TWITTER_ACCOUNT = 0;
public static int FB_ACCOUNT = 1;
SharedPreferences sp = getSharedPreferences(context);
which data I'll have to send to it to authenticate Fb users
Why not sending the
If a user log in with fb I will not have any password to save in the account
Just keep the access token. you should use fb access token to get data from FB or login to your system. have a look at
Also do note that you are missing the point if your users need to login each time the app starts
To save user data in
public void setUserData(final Account account, final String key, final String value)
public String getUserData(final Account account, final String key)