Closed romaluca closed 8 years ago
Thanks a lot for trying this!
Maybe you can look into the code for the existing third-party logins in Extensions.md
.
They also have a server-side part. So that could be what's missing to make this work.
Maybe @cprakashagr can help as well.
Anyway my code is not good. Everytime that meteor or android studio restart the projects the session is lost and i have to do the login again. with normal login this not happens. I try to ask in the meteor's forum
Hi, i've seen in your code that there is this private function:
private void saveLoginToken(final String token) {
final SharedPreferences prefs = getSharedPreferences();
final SharedPreferences.Editor editor = prefs.edit();
editor.putString(Preferences.Keys.LOGIN_TOKEN, token);
editor.apply();
}
Can you set a mode where i can pass you my token so you can save it in your sharedpreferences? In this way i can do login with facebook manually and persist it.
Thanks!
Have you tried the Google+ or LinkedIn logins that are referenced here? Do they have the same problem that your code has?
Regarding the private function saveLoginToken
, that actually saves the login token that the Meteor servers sends upon successful login with username/email and password.
Is this really the correct place for storing the Facebook token? Is that token something that you receive from the Meteor server as well?
As you can see in the initSession
method, the token is used in loginWithToken
to sign in using this token as a "resume" token. So it must be a token for a Meteor session.
Excuse me i've solved. before from meteor i returned { userId: .., authToken: ... } i've seen that you catch id and token so i changed the parameters name and it works!
Thanks!
Great to hear that it's working now. Your solution will also be useful for others trying to implement social sign-in in the future.
Do you want to put all your server-side and client-side code for this feature into a repository or "Gist"? We could link to it from the Extensions.md
file then.
I've nevere done it before. i'll try it :)
Is the GIST for the solution somewhere available? Thanks
@xpluscal Not yet, unfortunately, but @romaluca created it and wanted to share it :)
Hi, in your library therisn't loginWithFacebook method. I created a method in meteor for get params of accounts facebook and login the user with them.
It seems work. The user is logged. The problem is that if i do it, the property of your library:
.meteor.isLoggedIn()
continues to return false. Is there a way for set it a true, so i can use it everywhere like in the normal login?Thanks!