:doc:`LicenseManager <../../license-manager>` / Client / create_token

************
create_token
************



.. py:method:: LicenseManager.Client.create_token(**kwargs)

  

  Creates a long-lived token.

   

  A refresh token is a JWT token used to get an access token. With an access token, you can call AssumeRoleWithWebIdentity to get role credentials that you can use to call License Manager to manage the specified license.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/license-manager-2018-08-01/CreateToken>`_  


  **Request Syntax**
  ::

    response = client.create_token(
        LicenseArn='string',
        RoleArns=[
            'string',
        ],
        ExpirationInDays=123,
        TokenProperties=[
            'string',
        ],
        ClientToken='string'
    )
    
  :type LicenseArn: string
  :param LicenseArn: **[REQUIRED]** 

    Amazon Resource Name (ARN) of the license. The ARN is mapped to the aud claim of the JWT token.

    

  
  :type RoleArns: list
  :param RoleArns: 

    Amazon Resource Name (ARN) of the IAM roles to embed in the token. License Manager does not check whether the roles are in use.

    

  
    - *(string) --* 

    

  :type ExpirationInDays: integer
  :param ExpirationInDays: 

    Token expiration, in days, counted from token creation. The default is 365 days.

    

  
  :type TokenProperties: list
  :param TokenProperties: 

    Data specified by the caller to be included in the JWT token. The data is mapped to the amr claim of the JWT token.

    

  
    - *(string) --* 

    

  :type ClientToken: string
  :param ClientToken: **[REQUIRED]** 

    Idempotency token, valid for 10 minutes.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'TokenId': 'string',
          'TokenType': 'REFRESH_TOKEN',
          'Token': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **TokenId** *(string) --* 

        Token ID.

        
      

      - **TokenType** *(string) --* 

        Token type.

        
      

      - **Token** *(string) --* 

        Refresh token, encoded as a JWT token.

        
  
  **Exceptions**
  
  *   :py:class:`LicenseManager.Client.exceptions.ValidationException`

  
  *   :py:class:`LicenseManager.Client.exceptions.AuthorizationException`

  
  *   :py:class:`LicenseManager.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`LicenseManager.Client.exceptions.RateLimitExceededException`

  
  *   :py:class:`LicenseManager.Client.exceptions.ResourceLimitExceededException`

  
  *   :py:class:`LicenseManager.Client.exceptions.ServerInternalException`

  
  *   :py:class:`LicenseManager.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`LicenseManager.Client.exceptions.RedirectException`

  