Get Bearer Token
To access the API, users must authenticate and generate a bearer token. The bearer token serves as a form of authorization, granting access to protected resources. Follow these steps to generate a bearer token:
Open the Authentication Endpoint URL: Access the authentication endpoint URL in a web browser or a tool like Postman.
URL:
<Virtana URL>/authentication/oauth/token?grant_type=client_credentias&client_id=<client_id>&client_secret=<client_secret>
Example: URL: https://app.cloud.virtana.com
To get the client_id and client_secret, refer Generate OAuth Credentials .
Provide Authentication Credentials: Enter the required authentication credentials, which may include a username and password or client ID and client secret.
Submit the Authentication Request: Send the authentication request to the API server.
To retrieve an OAuth bearer token, use the /authorization/oauth/token endpoint. This endpoint supports various grant types and parameters.
Request Parameters
grant_type*: The grant type for the OAuth token request. Example: client_credentials
client_id*: The OAuth client ID. Example: 283gtr802edxxxx033b41dfa761cxxxxx
client_secret*: The OAuth client secret. Example: 3gfr2131dbbxxx1145f9xvbbndjdd
Receive the Bearer Token: Upon successful authentication, the API server will issue a bearer token.
Copy or Note the Bearer Token: Copy the bearer token from the response or securely note it down.
Example
Request
GET /authorization/oauth/token?grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>
Response
{ "access_token": "eyJhbGciOiJIUzI1NiIxxxxxxxxx....", "refresh_token": "eyJhbGciOiJIUzI1NiIsInRxxxxxxxxx....", "expires_in": 43xxx, "scope": "Scope", "token_type": "Bearer" }
Use the Bearer Token in Subsequent Requests: Utilize the bearer token in the Authorization header of subsequent API requests, prefixing it with 'Bearer' (e.g., 'Authorization: Bearer [token]'). This token grants access to the API's protected endpoints and resources.