:doc:`SSO <../../sso>` / Client / get_role_credentials

********************
get_role_credentials
********************



.. py:method:: SSO.Client.get_role_credentials(**kwargs)

  

  Returns the STS short-term credentials for a given role name that is assigned to the user.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sso-2019-06-10/GetRoleCredentials>`_  


  **Request Syntax**
  ::

    response = client.get_role_credentials(
        roleName='string',
        accountId='string',
        accessToken='string'
    )
    
  :type roleName: string
  :param roleName: **[REQUIRED]** 

    The friendly name of the role that is assigned to the user.

    

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

    The identifier for the AWS account that is assigned to the user.

    

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

    The token issued by the ``CreateToken`` API call. For more information, see `CreateToken <https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html>`__ in the *IAM Identity Center OIDC API Reference Guide*.

    

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

    
    ::

      {
          'roleCredentials': {
              'accessKeyId': 'string',
              'secretAccessKey': 'string',
              'sessionToken': 'string',
              'expiration': 123
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **roleCredentials** *(dict) --* 

        The credentials for the role that is assigned to the user.

        
        

        - **accessKeyId** *(string) --* 

          The identifier used for the temporary security credentials. For more information, see `Using Temporary Security Credentials to Request Access to AWS Resources <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html>`__ in the *AWS IAM User Guide*.

          
        

        - **secretAccessKey** *(string) --* 

          The key that is used to sign the request. For more information, see `Using Temporary Security Credentials to Request Access to AWS Resources <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html>`__ in the *AWS IAM User Guide*.

          
        

        - **sessionToken** *(string) --* 

          The token used for temporary credentials. For more information, see `Using Temporary Security Credentials to Request Access to AWS Resources <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html>`__ in the *AWS IAM User Guide*.

          
        

        - **expiration** *(integer) --* 

          The date on which temporary security credentials expire.

          
    
  
  **Exceptions**
  
  *   :py:class:`SSO.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`SSO.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`SSO.Client.exceptions.TooManyRequestsException`

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

  