CrossGeeks / FacebookClientPlugin

Facebook Client Plugin for Xamarin iOS and Android
MIT License
106 stars 32 forks source link

Loging in with facebook on Parse platform Server #9

Closed CDrosos closed 6 years ago

CDrosos commented 6 years ago

Hello, I would like to use this plugin to login my users on a parse server.

Now the best way in our days to login on Parse was something that is described here: https://stackoverflow.com/questions/40529682/making-a-prettier-facebook-login-screen-for-parse-com-server-with-xamarin-androi

which pretty much what it says is that after you do a native facebook login, with the return data you do something like this to login on Parse:

public async void OnSuccess(Object result)
    {
        // We know that this is a LoginResult
        var loginResult = (LoginResult) result;

        // Convert Java.Util.Date to DateTime
        var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
        var expireDate = epoch.AddMilliseconds(loginResult.AccessToken.Expires.Time);

        // FB User AccessToken
        var accessToken = loginResult.AccessToken.Token;

        ParseUser user = await ParseFacebookUtils.LogInAsync("Your Facebook App Id", accessToken, expireDate);
    }

But how i can get AccessToken and expireDate with your plugin? Thanks

CDrosos commented 6 years ago

@rdelrosario @Pujolsluis please assist :) :)

Pujolsluis commented 6 years ago

Hey @CDrosos , I'm glad you're looking forward to using the plugin! :D, thank you for submitting this issue. we will be working on it to enable the required properties.

rdelrosario commented 6 years ago

@CDrosos Just released a new version:

https://www.nuget.org/packages/Plugin.FacebookClient/1.1.0

Should be able to access token:

CrossFacebookClient.Current.ActiveToken

And expiration date as well:

CrossFacebookClient.Current.TokenExpirationDate
rdelrosario commented 6 years ago

Available on latest version

https://www.nuget.org/packages/Plugin.FacebookClient/1.2.0

stesvis commented 5 years ago

@rdelrosario would it be possible to also provide a property for the AuthorizationCode as well? https://developers.facebook.com/docs/accountkit/accesstokens/#authcode

I am consuming some APIs that required the code instead of the ActiveToken.