Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 1.72 KB

openapi_oauth_reference.md

File metadata and controls

63 lines (49 loc) · 1.72 KB

Xref Open API OAuth Reference

Authorization

Name Required? Description
state optional Unique string to be passed back upon completion
Name Description
code An authorization code you can use in the next call to get an access token for your user. This can only be used once and expires in 5 minutes.
state The value of the state parameter you provided on the initial GET request.
error Error code, if any error.

Token Issuance

Name Required? Type Description
client_id required string Issued when you created your application
client_secret required string Issued when you created your application
code required string The value of the code returned previously

Request:

curl -X POST https://api-open.xref.com/oauth/tokens \
    --header "Content-Type: application/json" \
    --data-binary "{
        \"client_id\": \"YOUR_CLIENT_ID\",
        \"client_secret\": \"YOUR_CLIENT_SECRET\",
        \"code\": \"AUTHORIZATION_CODE\"
    }"

Response:

{
  "access_token": "cb6f9d8c843c22e53db97f7fd2ff20ab58c91e31",
  "xref_account_id": "d1e01e1a36a09eda2a31b01caf62eb2e"
}

Deauthorize

Request:

curl -X POST https://api-open.xref.com/oauth/deauthorize \
   -H "Authorization: Token ACCESS_TOKEN"

Response:

{
  "access_token": "cb6f9d8c843c22e53db97f7fd2ff20ab58c91e31"
}