/// <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, CLIENT_ID, 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> public static IAuthorizationState GetState(StoredStateClient provider) { return provider.State; }
/// <summary> /// Returns the IAuthorizationState stored in the StoredStateClient instance. /// </summary> /// <param name="provider">OAuth2 client.</param> /// <returns>The stored authorization state.</returns> public static IAuthorizationState GetState(StoredStateClient provider) { provider.RefreshToken(provider.State); return provider.State; }
/// <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) { provider.RefreshToken(provider.State); return(provider.State); }
/// <summary> /// Retrieve an IAuthenticator instance using the provided state. /// </summary> /// <returns>Authenticator using the provided OAuth 2.0 credentials</returns> public static IAuthenticator GetAuthenticator(string refreshToken, string accessKey) { var credentials = new AuthorizationState(null) { RefreshToken = refreshToken, AccessToken = accessKey }; var provider = new StoredStateClient(GoogleAuthenticationServer.Description, "647667148.apps.googleusercontent.com", "SHvBqFmGtXq5bTPqY242oNvB", 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); }