示例#1
0
        private void OnAuthenticationResponse(HttpResponseMessage message)
        {
            if (message.StatusCode == HttpStatusCode.OK)
            {
                // on s'attend à recevoir un token
                // on add le token au HTTPClient

                string JSON = message.Content.ReadAsStringAsync().Result;
                JSONAuthenticationResponse authResponse = JsonUtility.FromJson <JSONAuthenticationResponse>(JSON);
                string token = authResponse.accessToken;
                m_HTTPClient.SetAuthenticationToken(token);

                m_onLoginCallbacks.Dequeue().Callback.Invoke(authResponse.id);
                m_readyForNextCall = true;
            }
            else
            {
#if DEBUG_LOG
                Debug.Log("Authentication login request was not successful");
#endif // DEBUG_LOG
            }
        }