关于如何用unity对接facebook登录,自己做一个记录:
var perms = new List() { “public_profile”, “email”/*,“user_friends” */}; FB.LogInWithReadPermissions(perms, (ILoginResult result) => { if (FB.IsLoggedIn) { var aToken = Facebook.Unity.AccessToken.CurrentAccessToken; Debug.LogError(“Facebook loginTokenUserId = " + aToken.UserId); Debug.LogError(“Facebook loginToken = " + aToken.TokenString); WWWForm form = new WWWForm(); form.AddField(“fields”, “token_for_business”); FB.API(”/me”, HttpMethod.POST, callback => { var TokenForBusiness = callback.ResultDictionary[“token_for_business”] as string; Debug.LogError("Facebook TokenForBusiness = " + TokenForBusiness); LoginSuccessCallBack(LandingType.FaceBook, aToken.TokenString, aToken.UserId, TokenForBusiness, TokenForBusiness); }, form); } }
最新评论: