/// <summary> /// Login /// </summary> /// <param name="authcode"></param> /// <param name="redirectUrl"></param> /// <returns>AccessToken</returns> /// <exception cref="ArgumentException"></exception> public async Task <AccessTokenDto> LoginAsync(string authcode, string redirectUrl) { if (string.IsNullOrEmpty(authcode)) { throw new ArgumentException("Value cannot be null or empty.", nameof(authcode)); } if (string.IsNullOrEmpty(redirectUrl)) { throw new ArgumentException("Value cannot be null or empty.", nameof(redirectUrl)); } var client = new AuthorizationApi(this.Configuration, this.Logger); var token = await client .CreateAccessTokenAsync(new AuthorizationCodeRequest( AuthorizationCodeRequest.GrantTypeEnum.Authorizationcode, authcode, redirectUrl)) .ConfigureAwait(false); return(AccessTokenDto.FromAccessTokenCreated(token)); }