/// <summary> /// Retrieve an IAuthenticator instance using the provided state. /// </summary> /// <param name="credentials">OAuth 2.0 credentials to use.</param> /// <returns>Authenticator using the provided OAuth 2.0 credentials</returns> public static IAuthenticator GetAuthenticatorFromState(IAuthorizationState credentials) { var provider = new StoredStateClient(GoogleAuthenticationServer.Description, ClientCredentials.CLIENT_ID, ClientCredentials.CLIENT_SECRET, credentials); var auth = new OAuth2Authenticator<StoredStateClient>(provider, StoredStateClient.GetState); auth.LoadAccessToken(); return auth; }
/// <summary> /// Returns the IAuthorizationState stored in the StoredStateClient instance. /// </summary> /// <param name="provider">OAuth2 client.</param> /// <returns>The stored authorization state.</returns> static public IAuthorizationState GetState(StoredStateClient provider) { return provider.State; }