Appearance
Exchange Facebook
POST/public/account/facebook/exchangeExchange the authorization code from Facebook for an access token. Call this right after the user completes the authorization step.
Endpoint Details
- Authentication: Basic Auth (
Authorization: Basic Base64(AccessKey:SecretKey)) - Access Tier: Gold+
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
code | string | Yes | The authorization code received from the OAuth redirect. |
Example Request
bash
curl -X POST "https://api.repliz.com/public/account/facebook/exchange" \
-H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
-H "Content-Type: application/json" \
-d '{}'javascript
import axios from 'axios';
const response = await axios.post('https://api.repliz.com/public/account/facebook/exchange', {}, {
auth: {
username: 'YOUR_ACCESS_KEY',
password: 'YOUR_SECRET_KEY'
}
});
console.log(response.data);javascript
const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');
const response = await fetch('https://api.repliz.com/public/account/facebook/exchange', {
method: 'POST',
headers: {
'Authorization': `Basic ${credentials}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({})
});
const data = await response.json();
console.log(data);Response
json
{
"token": "9402c20336a7c3ce2d8e4f763fd598ad7e09116ba611eeb4b429b31cce3dda1147e02582211155149b1024fd4995b352d3cc3a975dd18aca8d15b7c0d4531f340688f60649fa6ad053d2ca5b9de3df1cfae47261a16e3680416d82f85b025bdfc41154bdcbb5c01874499b76364ca959ecb5abb4cea1b798e947a6ecf6a471093d7ea7d9a40718f2fed191b2ced80405b6bbfa64bce0d577707be9286a980b9f0a8e0a335e6b1ab0559a2b9be13c2101ade91ab964e7a483edcb4834f2d60021b276f37f678407794a72ae0fc95c835006cc5d6c4f874072db08c786417f977760727edf006016e8b655533382675406.2255a73f-8431-4458-abcf-ee7f867952db"
}json
{
"code": 401,
"message": "unauthorized"
}