public void Simple() { var secrets = new SecretsProvider().Get(); var jwtCreator = new JwtCreator(); var expirationTime = TimeSpan.FromMinutes(15); var privateKeyStream = new MemoryStream(Encoding.UTF8.GetBytes(secrets.AuthorizationKeyPrivateKey)); var jwtToken = jwtCreator.Create( secrets.ServiceAccountId, secrets.AuthorizationKeyId, privateKeyStream, expirationTime ); output.WriteLine(jwtToken); }
/// <summary> /// Authorizes the client with the given <see cref="AuthValues"/>. /// </summary> /// <param name="authValues">The values to use for authorization.</param> public virtual async Task <IdentityClient> AuthorizeClient(AuthValues authValues) { if (!IsClientLoggedIn(authValues.Jwt)) { authValues.Jwt = JwtCreator.CreateJwt(authValues); var clientInfo = await GetClientInfo(authValues); if (clientInfo.Error != null) { throw new ApiException(clientInfo.Error); } if (clientInfo.HasValue) { _adobeClientStore.Client = clientInfo.Value; } } return(_adobeClientStore.Client); }