Spaces:
Sleeping
Sleeping
File size: 641 Bytes
9540270 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # OAuth2 Authentication Guide
## Overview
This guide explains how to authenticate API requests using OAuth2.
## Getting an Access Token
Make a POST request to the token endpoint:
```bash
curl -X POST https://api.example.com/auth/token \
-d "grant_type=client_credentials" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET"
```
## Using the Access Token
Include the token in the Authorization header:
```bash
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://api.example.com/data
```
## Token Expiration
Access tokens expire after 1 hour. Refresh tokens can be used to obtain new access tokens.
|