Пример #1
0
 internal static async Task GetTokenIfEmptyAsync(AuthTokenType authTokenType)
 {
     if (authTokenType == AuthTokenType.SignIn && signInToken == null)
     {
         signInToken = Utility.ReadFromLocalStorage<OAuthToken>(Utility.SignInTokenKey);
         if (signInToken != null)
             await signInToken.GetActiveTokenAsync();
     }
     else if (authTokenType == AuthTokenType.SignUp && signUpToken == null)
     {
         signUpToken = Utility.ReadFromLocalStorage<OAuthToken>(Utility.SignUpTokenKey);
         if (signUpToken != null)
             await signUpToken.GetActiveTokenAsync();
     }
     else if (authTokenType == AuthTokenType.Simple && simpleToken == null)
     {
         simpleToken = Utility.ReadFromLocalStorage<OAuthToken>(Utility.SimpleTokenKey);
         if (simpleToken != null)
             await simpleToken.GetActiveTokenAsync();
     }
     else if (authTokenType == AuthTokenType.PrepaidSignIn && signInToken == null)
     {
         signInToken = Utility.ReadFromLocalStorage<OAuthToken>(Utility.PrepaidSignInTokenKey);
         if (signInToken != null)
             await signInToken.GetActiveTokenAsync();
     }
 }
Пример #2
0
 internal static async Task<string> GetAuthTokenAsync(AuthTokenType authTokenType)
 {
     switch (authTokenType)
     {
         case AuthTokenType.SignIn:
             return signInToken != null ? await signInToken.GetActiveTokenAsync() : string.Empty;
         case AuthTokenType.SignUp:
             return signUpToken != null ? await signUpToken.GetActiveTokenAsync() : string.Empty;
         case AuthTokenType.Simple:
             return simpleToken != null ? await simpleToken.GetActiveTokenAsync() : string.Empty;
         case AuthTokenType.PrepaidSignIn:
             return signInToken != null ? await signInToken.GetActiveTokenAsync() : string.Empty;
         default:
             return string.Empty;
     }
 }