Skip to content

Instantly share code, notes, and snippets.

@mtvbrianking
Last active September 21, 2019 14:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtvbrianking/b8524b68d30c7eb2cb37e3a9e5f2e04d to your computer and use it in GitHub Desktop.
Save mtvbrianking/b8524b68d30c7eb2cb37e3a9e5f2e04d to your computer and use it in GitHub Desktop.
Sample API request tokens requests
curl -X POST \
  http://localhost:8000/api/v1/oauth/token \
  -H 'Accept: application/json' \
  -d 'grant_type=authorization_code' \
  -d 'client_id=b8e7163a-83a0-4386-b0bc-697a96edef14' \
  -d 'client_secret=bNQbpQnMPXayTn8XFPRQDWvIyyclN5pKnccVVUNx' \
  -d 'redirect_uri=http://localhost:8000/test/callback' \
  -d 'code=def502006626c316151b4f074308...'

curl -X POST \
  http://localhost:8000/api/v1/oauth/token \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "grant_type": "authorization_code",
    "client_id": "b8e7163a-83a0-4386-b0bc-697a96edef14",
    "client_secret": "bNQbpQnMPXayTn8XFPRQDWvIyyclN5pKnccVVUNx",
    "redirect_uri": "http://localhost:8000/test/callback",
    "code": "def502006626c316151b4f074308..."
  }'

# ...

curl -X POST \
  http://localhost:8000/api/v1/oauth/token \
  -H 'Accept: application/json' \
  -d 'grant_type=client_credentials' \
  -d 'client_id=0dfc8252-4e70-4e58-bd4d-f1e0babf8fe7' \
  -d 'client_secret=rla2Kk3e9L7qMQ2VnpbSWRQSkuVR8m8JndU7t4uu'

curl -X POST \
  http://localhost:8000/api/v1/oauth/token \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "grant_type": "password",
    "client_id": "0dfc8252-4e70-4e58-bd4d-f1e0babf8fe7",
    "client_secret": "rla2Kk3e9L7qMQ2VnpbSWRQSkuVR8m8JndU7t4uu"
  }'

# ...

curl -X POST \
  http://localhost:8000/api/v1/oauth/token \
  -H 'Accept: application/json' \
  -d 'grant_type=password' \
  -d 'client_id=0dfc8252-4e70-4e58-bd4d-f1e0babf8fe7' \
  -d 'client_secret=rla2Kk3e9L7qMQ2VnpbSWRQSkuVR8m8JndU7t4uu' \
  -d 'username=jdoe@example.com' \
  -d 'password=12345678'

curl -X POST \
  http://localhost:8000/api/v1/oauth/token \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "grant_type": "password",
    "client_id": "0dfc8252-4e70-4e58-bd4d-f1e0babf8fe7",
    "client_secret": "rla2Kk3e9L7qMQ2VnpbSWRQSkuVR8m8JndU7t4uu",
    "username": "jdoe@example.com",
    "password": "12345678"
  }'

# ...

curl -X POST \
  http://localhost:8000/api/v1/oauth/token \
  -H 'Accept: application/json' \
  -d 'grant_type=refresh_token' \
  -d 'client_id=0dfc8252-4e70-4e58-bd4d-f1e0babf8fe7' \
  -d 'client_secret=rla2Kk3e9L7qMQ2VnpbSWRQSkuVR8m8JndU7t4uu' \
  -d 'refresh_token=def502006626c316151b4f074308...'

curl -X POST \
  http://localhost:8000/api/v1/oauth/token \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "grant_type": "refresh_token",
    "client_id": "0dfc8252-4e70-4e58-bd4d-f1e0babf8fe7",
    "client_secret": "rla2Kk3e9L7qMQ2VnpbSWRQSkuVR8m8JndU7t4uu",
    "refresh_token": "def502006626c316151b4f074308..."
  }'

# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment