ImgurNet.Authentication.OAuth2Authentication.AuthorizeWithToken C# (CSharp) Метод

AuthorizeWithToken() публичный Метод

Authorizes with the tokens that you recieved from the url in CreateAuthorizationUrl
public AuthorizeWithToken ( string accessToken, string refreshToken, int expiresIn, string authorizedUsername ) : void
accessToken string The you recieved.
refreshToken string The you recieved.
expiresIn int The you recieved.
authorizedUsername string The Username of the account that has been authorized.
Результат void
		public void AuthorizeWithToken(string accessToken, string refreshToken, int expiresIn, string authorizedUsername)
		{
			AccessToken = accessToken;
			RefreshToken = refreshToken;
			ExpiresAt = DateTime.UtcNow.AddSeconds(expiresIn);
			AuthorizedUsername = authorizedUsername;
		}

Usage Example

Пример #1
0
		public static async Task<OAuth2Authentication> GetAccessToken(OAuth2Authentication authentication, TestSettings settings)
		{
			authentication.AuthorizeWithToken(settings.AccessToken, settings.RefreshToken, 3600, settings.AuthorizedUsername);
			await authentication.RefreshTokens();

			settings.AccessToken = authentication.AccessToken;
			settings.RefreshToken = authentication.RefreshToken;
			VariousFunctions.SaveTestSettings(settings);

			return authentication;
		}