Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 2.68 KB

File metadata and controls

49 lines (33 loc) · 2.68 KB

TokenService

A list of all methods in the TokenService service. Click on the method name to view detailed information about that method.

Methods Description
generate_token The Generate Token endpoint exchanges the authorization code received from the client application for an access token and a refresh token. The client uses the access token to make API requests on behalf of the user by including it in the authorization header. The access token will expire after a certain period and can be refreshed by using the /refresh endpoint.

generate_token

The Generate Token endpoint exchanges the authorization code received from the client application for an access token and a refresh token. The client uses the access token to make API requests on behalf of the user by including it in the authorization header. The access token will expire after a certain period and can be refreshed by using the /refresh endpoint.

  • HTTP Method: POST
  • Endpoint: /security/v1/oauth/token

Parameters

Name Type Required Description
request_body GenerateTokenRequest ❌ The request body.

Return Type

GenerateTokenSuccessResponse

Example Usage Code Snippet

from ups_0auth_code import Ups0authCode, Environment
from ups_0auth_code.models import GenerateTokenRequest

sdk = Ups0authCode(
    username="YOUR_USERNAME",
    password="YOUR_PASSWORD",
    base_url=Environment.DEFAULT.value
)

request_body = GenerateTokenRequest(
    grant_type="authorization_code",
    code="code",
    redirect_uri="redirect_uri"
)

result = sdk.token.generate_token(request_body=request_body)

print(result)