generateTokenWithHttpInfo method

Future<Response> generateTokenWithHttpInfo(
  1. String account, {
  2. GenerateTokenRequest? generateTokenRequest,
})

Generate a token

Generate a new token resource for a user, using the user's email and password. Keygen does not store your tokens for security reasons. After a token is generated, it cannot be recovered if lost. The token will need to be revoked if lost, and a new token should be generated. Alternatively, the existing token can be regenerated (rolled). By default, user tokens expire in 2 weeks, and admin tokens do not expire. A custom expiry may be provided in the token generate request. If the user does not have a password, a token must be generated via the user's token relationship To generate a token for a product, see the product token relationship. To generate a license token, see the license token relationship.

Note: This method returns the HTTP Response.

Parameters:

Implementation

Future<Response> generateTokenWithHttpInfo(String account, { GenerateTokenRequest? generateTokenRequest, }) async {
  // ignore: prefer_const_declarations
  final path = r'/accounts/{account}/tokens'
    .replaceAll('{account}', account);

  // ignore: prefer_final_locals
  Object? postBody = generateTokenRequest;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['application/vnd.api+json'];


  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}