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;
		}