Beispiel #1
0
        public void GetIdToken(Action <string> idTokenCallback)
        {
            if (!this.IsAuthenticated())
            {
#if BUILD_TYPE_DEBUG
                Debug.Log("Cannot get API client - not authenticated");
#endif
                PlayGamesHelperObject.RunOnGameThread(() =>
                                                      idTokenCallback(null));
            }

            if (!GameInfo.WebClientIdInitialized())
            {
                //don't spam the log, only do this every webclientWarningFreq times.
                if (noWebClientIdWarningCount++ % webclientWarningFreq == 0)
                {
                    Debug.LogError("Web client ID has not been set, cannot request id token.");
                    // avoid int overflow
                    noWebClientIdWarningCount = (noWebClientIdWarningCount / webclientWarningFreq) + 1;
                }
                PlayGamesHelperObject.RunOnGameThread(() =>
                                                      idTokenCallback(null));
            }
            mTokenClient.SetRationale(rationale);
            mTokenClient.GetIdToken(GameInfo.WebClientId,
                                    AsOnGameThreadCallback(idTokenCallback));
        }
 /// <summary>
 /// Returns an id token, which can be verified server side, if they are logged in.
 /// </summary>
 /// <param name="idTokenCallback"> A callback to be invoked after token is retrieved. Will be passed null value
 /// on failure. </param>
 /// <returns>The identifier token.</returns>
 public string GetIdToken()
 {
     if (!this.IsAuthenticated())
     {
         Debug.Log("Cannot get API client - not authenticated");
         return(null);
     }
     return(mTokenClient.GetIdToken());
 }
Beispiel #3
0
        /// <summary>
        /// Returns an id token, which can be verified server side, if they are logged in.
        /// </summary>
        /// <returns>The identifier token.</returns>
        public string GetIdToken()
        {
            if (!this.IsAuthenticated())
            {
                Debug.Log("Cannot get API client - not authenticated");
                return(null);
            }

            if (!GameInfo.WebClientIdInitialized())
            {
                //don't spam the log, only do this every webclientWarningFreq times.
                if (noWebClientIdWarningCount++ % webclientWarningFreq == 0)
                {
                    Debug.LogError("Web client ID has not been set, cannot request id token.");
                    // avoid int overflow
                    noWebClientIdWarningCount = (noWebClientIdWarningCount / webclientWarningFreq) + 1;
                }
                return(null);
            }
            return(mTokenClient.GetIdToken(GameInfo.WebClientId));
        }
        public void GetIdToken(Action <string> idTokenCallback)
        {
            if (!this.IsAuthenticated())
            {
                Debug.Log("Cannot get API client - not authenticated");
                idTokenCallback(null);
            }

            if (!GameInfo.WebClientIdInitialized())
            {
                //don't spam the log, only do this every webclientWarningFreq times.
                if (noWebClientIdWarningCount++ % webclientWarningFreq == 0)
                {
                    Debug.LogError("Web client ID has not been set, cannot request id token.");
                    // avoid int overflow
                    noWebClientIdWarningCount = (noWebClientIdWarningCount / webclientWarningFreq) + 1;
                }
                idTokenCallback(null);
            }
            mTokenClient.SetRationale(rationale);
            mTokenClient.GetIdToken(GameInfo.WebClientId, idTokenCallback);
        }