ImgurNet.Authentication.OAuth2Authentication.AuthorizeWithToken C# (CSharp) Method

AuthorizeWithToken() public method

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.
return 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
ファイル: OAuthHelpers.cs プロジェクト: 0xdeafcafe/ImgurNet
		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;
		}