public override void RequestBind(BindResultCallback bind_callback = null) { Debug.Log("[FacebookAuthProvider] RequestBind"); mBindResultCallback = bind_callback; string auth_login = PlayerPrefs.GetString(SnipePrefs.AUTH_UID); string auth_token = PlayerPrefs.GetString(SnipePrefs.AUTH_KEY); if (!string.IsNullOrEmpty(auth_login) && !string.IsNullOrEmpty(auth_token)) { if (FB.IsLoggedIn && AccessToken.CurrentAccessToken != null) { ExpandoObject data = new ExpandoObject() { ["messageType"] = REQUEST_USER_BIND, ["provider"] = ProviderId, ["login"] = AccessToken.CurrentAccessToken.UserId, ["auth"] = AccessToken.CurrentAccessToken.TokenString, ["loginInt"] = auth_login, ["authInt"] = auth_token, }; Debug.Log("[FacebookAuthProvider] send user.bind " + data.ToJSONString()); SingleRequestClient.Request(SnipeConfig.Instance.auth, data, OnBindResponse); return; } } FacebookProvider.InstanceInitializationComplete -= OnFacebookProviderInitializationComplete; FacebookProvider.InstanceInitializationComplete += OnFacebookProviderInitializationComplete; InvokeBindResultCallback(ERROR_NOT_INITIALIZED); }
public override void RequestBind(BindResultCallback bind_callback = null) { Debug.Log("[GooglePlayAuthProvider] RequestBind"); mBindResultCallback = bind_callback; #if UNITY_ANDROID if (PlayerPrefs.HasKey(SnipePrefs.AUTH_UID) && PlayerPrefs.HasKey(SnipePrefs.AUTH_KEY)) { if (GooglePlayProvider.InstanceInitialized) { Debug.Log("[GooglePlayAuthProvider] GetServerAuthToken"); GooglePlayProvider.Instance.GetServerAuthToken((google_token) => { if (string.IsNullOrEmpty(google_token)) { Debug.Log("[GooglePlayAuthProvider] google_token is empty"); InvokeBindResultCallback(AuthProvider.ERROR_NOT_INITIALIZED); return; } string auth_login = PlayerPrefs.GetString(SnipePrefs.AUTH_UID); string auth_token = PlayerPrefs.GetString(SnipePrefs.AUTH_KEY); if (string.IsNullOrEmpty(auth_login) || string.IsNullOrEmpty(auth_token)) { Debug.Log("[GooglePlayAuthProvider] internal uid or token is invalid"); InvokeBindResultCallback(AuthProvider.ERROR_PARAMS_WRONG); return; } ExpandoObject data = new ExpandoObject(); data["messageType"] = REQUEST_USER_BIND; data["provider"] = ProviderId; data["login"] = GooglePlayProvider.Instance.PlayerProfile.Id; data["auth"] = google_token; data["loginInt"] = auth_login; data["authInt"] = auth_token; Debug.Log("[GooglePlayAuthProvider] send user.bind " + data.ToJSONString()); SingleRequestClient.Request(SnipeConfig.Instance.auth, data, OnBindResponse); }); return; } } GooglePlayProvider.InstanceInitializationComplete -= OnGooglePlayProviderInitializationComplete; GooglePlayProvider.InstanceInitializationComplete += OnGooglePlayProviderInitializationComplete; #endif InvokeBindResultCallback(ERROR_NOT_INITIALIZED); }
public override void RequestBind(BindResultCallback bind_callback = null) { Debug.Log("[AppleGameCenterAuthProvider] RequestBind"); mBindResultCallback = bind_callback; #if UNITY_IOS if (PlayerPrefs.HasKey(SnipePrefs.AUTH_UID) && PlayerPrefs.HasKey(SnipePrefs.AUTH_KEY)) { if (AppleGameCenterProvider.InstanceInitialized) { string gc_login = AppleGameCenterProvider.Instance.PlayerProfile.Id; if (!string.IsNullOrEmpty(gc_login)) { mLoginSignatureCallback = (data) => { Debug.Log("[AppleGameCenterAuthProvider] RequestBind - LoginSignatureCallback"); string auth_login = PlayerPrefs.GetString(SnipePrefs.AUTH_UID); string auth_token = PlayerPrefs.GetString(SnipePrefs.AUTH_KEY); if (string.IsNullOrEmpty(auth_login) || string.IsNullOrEmpty(auth_token)) { Debug.Log("[AppleGameCenterAuthProvider] internal uid or token is invalid"); InvokeBindResultCallback(AuthProvider.ERROR_PARAMS_WRONG); return; } data["messageType"] = REQUEST_USER_BIND; data["provider"] = ProviderId; data["login"] = gc_login; //data["auth"] = login_token; data["loginInt"] = auth_login; data["authInt"] = auth_token; Debug.Log("[AppleGameCenterAuthProvider] send user.bind " + data.ToJSONString()); SingleRequestClient.Request(SnipeConfig.Instance.auth, data, OnBindResponse); }; generateIdentityVerificationSignature(VerificationSignatureGeneratorCallback); return; } return; } } AppleGameCenterProvider.InstanceInitializationComplete -= OnAppleGameCenterProviderInitializationComplete; AppleGameCenterProvider.InstanceInitializationComplete += OnAppleGameCenterProviderInitializationComplete; #endif InvokeBindResultCallback(ERROR_NOT_INITIALIZED); }
public override void RequestAuth(AuthSuccessCallback success_callback, AuthFailCallback fail_callback, bool reset_auth = false) { mAuthSuccessCallback = success_callback; mAuthFailCallback = fail_callback; #if UNITY_IOS if (AppleGameCenterProvider.InstanceInitialized) { string gc_login = AppleGameCenterProvider.Instance.PlayerProfile.Id; if (!string.IsNullOrEmpty(gc_login)) { mLoginSignatureCallback = (data) => { Debug.Log("[AppleGameCenterAuthProvider] RequestAuth - LoginSignatureCallback"); data["messageType"] = REQUEST_USER_LOGIN; data["login"] = gc_login; if (reset_auth) { data["resetInternalAuth"] = reset_auth; } SingleRequestClient.Request(SnipeConfig.Instance.auth, data, OnAuthLoginResponse); }; generateIdentityVerificationSignature(VerificationSignatureGeneratorCallback); return; } } else { AppleGameCenterProvider.InstanceInitializationComplete -= OnAppleGameCenterProviderInitializationComplete; AppleGameCenterProvider.InstanceInitializationComplete += OnAppleGameCenterProviderInitializationComplete; } #endif InvokeAuthFailCallback(AuthProvider.ERROR_NOT_INITIALIZED); }
public override void RequestBind(BindResultCallback bind_callback = null) { Debug.Log("[AdvertisingIdAuthProvider] RequestBind"); //NeedToBind = false; mBindResultCallback = bind_callback; void advertising_id_callback(string advertising_id, bool tracking_enabled, string error) { Debug.Log($"[AdvertisingIdAuthProvider] advertising_id : {advertising_id} , {error}"); AdvertisingId = advertising_id; string auth_login = PlayerPrefs.GetString(SnipePrefs.AUTH_UID); string auth_token = PlayerPrefs.GetString(SnipePrefs.AUTH_KEY); if (string.IsNullOrEmpty(auth_login) || string.IsNullOrEmpty(auth_token)) { Debug.Log("[AdvertisingIdAuthProvider] internal uid or token is invalid"); InvokeBindResultCallback(AuthProvider.ERROR_PARAMS_WRONG); } else { if (CheckAdvertisingId(advertising_id)) { ExpandoObject data = new ExpandoObject() { ["messageType"] = REQUEST_USER_BIND, ["provider"] = ProviderId, ["login"] = advertising_id, ["loginInt"] = auth_login, ["authInt"] = auth_token, }; Debug.Log("[AdvertisingIdAuthProvider] send user.bind " + data.ToJSONString()); SingleRequestClient.Request(SnipeConfig.Instance.auth, data, OnBindResponse); } else { Debug.Log("[AdvertisingIdAuthProvider] advertising_id is invalid"); InvokeBindResultCallback(AuthProvider.ERROR_NOT_INITIALIZED); } } } if (!Application.RequestAdvertisingIdentifierAsync(advertising_id_callback)) { if (DeviceIdFallbackEnabled && SystemInfo.unsupportedIdentifier != SystemInfo.deviceUniqueIdentifier) { advertising_id_callback(SystemInfo.deviceUniqueIdentifier, false, ""); } else { Debug.Log("[AdvertisingIdAuthProvider] advertising id is not supported on this platform"); InvokeAuthFailCallback(AuthProvider.ERROR_NOT_INITIALIZED); } } }