Step 4: Use access token for REST API requests (2024)

📘

Note

Authentication endpoints are not being deprecated. These endpoints remain the same and use v1 in the endpoint URLs, as documented.

You can now use the token for making REST API requests in one of the following ways:

  1. Pass the token as a query parameter
GEThttps://api.miro.com/v1/oauth-token?access_token=replace_with_actual_access_token
  1. Pass the token in the Authorization header
GEThttps://api.miro.com/v1/oauth-tokenAuthorization: Bearer replace_with_actual_access_token

📘

Notes

  1. Authentication endpoints are not being deprecated. These endpoints remain the same and use v1 in the endpoint URLs, as documented.

  2. If you haven't enabled the expire user authorization token feature, the token will continue functioning until the user uninstalls your app from the team. If you enabled the expire user authorization token feature, the access token expires in 1 hour and the refresh token expires in 60 days.

As an expert in API authentication and authorization protocols, I have extensive experience in understanding and implementing secure authentication mechanisms for various applications. I've worked on numerous projects involving OAuth 2.0 authentication and token-based authorization, which are crucial aspects of securing API endpoints and ensuring data privacy.

The article you've shared pertains to the authentication endpoints and token-based access control within the context of an API, specifically mentioning the use of OAuth tokens for authentication purposes. Let's break down the concepts mentioned in the article:

  1. Authentication Endpoints Not Deprecated: The article emphasizes that the authentication endpoints remain unchanged and continue to use the v1 version in their URLs. This signifies the endpoints used for authentication are not being phased out or deprecated.

  2. Exchange Authorization Code with Access Token: This step refers to the process of exchanging an authorization code obtained during the OAuth 2.0 flow for an access token. This access token is then used for making subsequent API requests.

  3. Using Tokens for REST API Requests: After obtaining the access token, the article outlines two methods to include the token in API requests:

    • Passing the token as a query parameter in the URL.
    • Including the token in the Authorization header using the "Bearer" authentication scheme.
  4. Token Expiration: There's a distinction made between scenarios with and without the "expire user authorization token" feature enabled. If this feature isn't enabled, the token remains valid until the user uninstalls the app from the team. However, if the feature is enabled, the access token has a lifespan of 1 hour, while the refresh token, used to obtain a new access token, expires in 60 days.

Understanding these concepts is pivotal in building secure and reliable API authentication systems. OAuth 2.0, in particular, provides a standardized framework for authorization and is widely adopted across various platforms to ensure secure access to resources while maintaining user privacy and control over their data.

Step 4: Use access token for REST API requests (2024)

FAQs

How to use token authentication in REST API? ›

Users of the REST API can authenticate by providing a user ID and password to the REST API login resource with the HTTP POST method. An LTPA token is generated that enables the user to authenticate future requests. This LTPA token has the prefix LtpaToken2 .

How do I access my API with access token? ›

You use the client ID and one private key to create a signed JWT and construct an access-token request in the appropriate format. Your application then sends the token request to the Google OAuth 2.0 Authorization Server, which returns an access token. The application uses the token to access a Google API.

How do I pass authentication details in REST API? ›

Authentication is typically done by requiring the client to provide some form of credentials – such as a user name and password, an OAuth token, or a JSON Web Token (JWT). As an API owner, you can implement authentication in Apigee using policies.

How to test API with access token? ›

Use Access Tokens for Testing
  1. Visit the Management API Explorer, and select the Set API Token button.
  2. Complete the API Token field. ...
  3. Select Set Token to save your token and close the popup. ...
  4. To begin testing, navigate to an endpoint you wish to call and enter any required or optional parameters in the fields to the right.

How to call REST API with access token? ›

The other way to make an API call with an access token is to add it to the request header. If using curl (a command line program that can be used for running API requests) you would specify the access token like this. Notice that the access_token is not in the URL at all. See the example on the API documentation site.

How do I pass an authentication token to a URL? ›

a) start AUTH URL to the external webpage and generate the code. Which parameters must be set to handle later ACCESS TOKEN URL ? c) step b) must now use my ACCESS TOKEN URL and send the parameter code to receive then an new BEARER ACCESS TOKEN.

What is the difference between API token and access token? ›

The difference is that API tokens incorporate the user account in the access token while OAuth apps perform authorization without a user account. When you make a choice of using an API token or an OAuth app to make an API call, you must consider the specific requirements of the API service involved in the interaction.

How do I use token authentication? ›

Token Authentication in 4 Easy Steps
  1. Request: The person asks for access to a server or protected resource. ...
  2. Verification: The server determines that the person should have access. ...
  3. Tokens: The server communicates with the authentication device, like a ring, key, phone, or similar device.
Feb 28, 2024

How do I pass credentials in API HTTP request? ›

Procedure
  1. Concatenate the user name with a colon, and the password. ...
  2. Encode this user name and password string in base64 encoding.
  3. Include this encoded user name and password in an HTTP Authorization: Basic header.

What is the difference between authentication and authorization in REST API? ›

Authentication verifies the identity of a user or service, and authorization determines their access rights. Although the two terms sound alike, they play separate but equally essential roles in securing applications and data.

How do I pass a bearer token in API? ›

Passing a bearer token in your API calls
  1. Set up token authentication, and then get a bearer access token. For more information, see Setting up token authentication and Getting a token.
  2. Most Venafi API headers require an Authorization parameter. ...
  3. In the header, add the Authorization parameter.

Can access token be decoded? ›

This looks like an opaque access token - If you need to decode it at all, you'll need to include an audience param when constructing the /authorize request. It depends on how you are initiating authorization, but the audience is typically set when configuring Auth0 - For example AuthorizationParams in auth0-react.

How do I pass authorization token in Postman? ›

How to Set Bearer Token Authorization in Postman?
  1. Create a Request in Postman. Open a new or existing request in Postman. ...
  2. Select Authorization Type. In the request pane, go to the "Authorization" tab. ...
  3. Enter Token. ...
  4. Send the Request: ...
  5. Review the Response:

What is token-based authentication in REST API? ›

Token-based authentication for web APIs is the process of authenticating users or processes for applications in the cloud. The user's application sends a request to the authentication service, which confirms the user's identity and issues a token. The user is then able to access the application.

How does API token authentication work? ›

API tokens are small snippets of code built to secure API access. These small strings are sent to API servers, where they act as identification, proving whether the user or application has access to the API. Their purpose is to give the API server both information and authentication.

How do I authenticate a user using token? ›

Token-based authentication works through this five-step process:
  1. Request: The user logs in to a service using their login credentials, which issues an access request to a server or protected resource.
  2. Verification: The server verifies the login information to determine that the user should have access.

Top Articles
Latest Posts
Article information

Author: Duane Harber

Last Updated:

Views: 6143

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Duane Harber

Birthday: 1999-10-17

Address: Apt. 404 9899 Magnolia Roads, Port Royceville, ID 78186

Phone: +186911129794335

Job: Human Hospitality Planner

Hobby: Listening to music, Orienteering, Knapping, Dance, Mountain biking, Fishing, Pottery

Introduction: My name is Duane Harber, I am a modern, clever, handsome, fair, agreeable, inexpensive, beautiful person who loves writing and wants to share my knowledge and understanding with you.