Skip to content
TALA
Esc
navigateopen⌘Jpreview

Exchanges the one-time code from the OAuth success redirect (?code=...) for a session. The code is single-use and expires in ~60s. Returns the same shape as login. Replaces returning tokens directly in the OAuth redirect URL.

POST/api/auth/oauth/exchange
Request body
requiredapplication/json
codestringrequired
The one-time code returned on the OAuth success redirect (?code=...).
Responses
200OK
any
401Unauthorized — code missing, already used, or expired (~60s TTL).
any
500Internal Server Error
any
Try it
Server
Bodyapplication/json
Request
curl -X POST "http://localhost:8000/api/auth/oauth/exchange" \
  -H "Content-Type: application/json" \
  -d '{
  "code": "9f8c1b2e4a6d7c3f…"
}'
Response
{
  "message": "You are logged-in successfully",
  "data": {
    "user": {
      "id": "CRa7Bk9x2Q",
      "fullName": null,
      "email": "example@mail.com",
      "role": "CONTENT_CREATOR",
      "accountStatus": "VERIFIED",
      "imageUrl": null
    },
    "token": {
      "accessToken": "**********",
      "refreshToken": "**********"
    }
  }
}