This article explains how to create an OAuth 2.0 access token in the Post Affiliate Pro API v3 (REST API) documentation and use it for authentication directly from your browser.
What is an OAuth token
OAuth 2.0 tokens are temporary credentials used to authenticate your API requests. The token grants access to API endpoints according to the permissions (scopes) you specify when creating it. OAuth is best for interactive applications, development, or testing environments where short-term access is sufficient.
For permanent server-to-server integrations use an API key instead. See how to create and use API key.
How to create an OAuth token
Follow the steps below to generate an OAuth access token in the API documentation and authorize your requests.
In your merchant panel go to Configuration > Tools > Integration > API v3 (REST API) and click View API documentation.
In the Authentication section expand POST /oauth/token.
In the Request body, enter your merchant credentials. Optionally add: scope to limit permissions, name to label the token, and valid_to_date to set the token expiration. If you use two-factor authentication, include two_factor_token.
Click Execute. If successful, the response contains your access_token. Copy the token value.
Click Authorize at the top of the documentation. Under bearerAuth (http, Bearer) paste your token and confirm.
Once authorized, your OAuth token will be used automatically for all API requests executed from the documentation. You can now make test calls and confirm that your token works as expected.
The OAuth token is temporary and will expire after the period defined in the expires_in field of the response (for example, 2595600 = 30 days). After expiration, you will need to generate a new one using POST /oauth/token.
Keep your access token secure. Anyone with this token can access your API data during its validity period. If you suspect that your token has been exposed, revoke it using POST /oauth/revoke and generate a new one.