IEnumerator GetRefreshToken() { UnityWebRequest webRequest = UnityWebRequest.Get($"http://teal-fire.com/MapMoves/refresh.php?refresh={currentResponse.refresh_token}"); yield return(webRequest.SendWebRequest()); if (webRequest.isNetworkError || webRequest.isHttpError) { Debug.Log("<b>GOOGLE PHOTOS</b> - Could not refresh access token"); } else { Debug.Log("<b>GOOGLE PHOTOS</b> - Access token refreshed"); GoogleOauthResponse response = JsonConvert.DeserializeObject <GoogleOauthResponse>(webRequest.downloadHandler.text); response.SetEndTime(); PlayerPrefs.SetString("GoogleOauthResponse", EncryptString(JsonConvert.SerializeObject(response), key, iv)); currentResponse = response; SendRequest(); } }
void TryGetTokenJson() { string tempString = GUIUtility.systemCopyBuffer; try { string decrypted = this.DecryptString(tempString, key, iv); Debug.Log(decrypted); GoogleOauthResponse response = JsonConvert.DeserializeObject <GoogleOauthResponse>(decrypted); response.SetEndTime(); PlayerPrefs.SetString("GoogleOauthResponse", EncryptString(JsonConvert.SerializeObject(response), key, iv)); Debug.Log("<b>GOOGLE PHOTOS</b> - Recieved api keys"); currentResponse = response; waitingForToken = false; animator.SetTrigger("Close"); couldNotRecognise.SetActive(false); loggedIn.SetActive(true); OnLogin(); SendRequest(); } catch (Exception ex) { Debug.Log("Invalid JSON!"); couldNotRecognise.SetActive(true); } }