Getting Access Tokens from Social Login Providers

Cotter stores all OAuth Tokens that are returned from the Social Login Providers when a user sign in. You can retrieve the tokens using the following API Requests.

Get a List of Access Tokens from All Social Logins for a User

GET https://www.cotter.app/api/v0/oauth/token/list/:cotter_user_id

This will give you a list of access tokens that the user has for each social login provider that is associated with their account.

Path Parameters

Name
Type
Description

cotter_user_id

string

The user's Cotter User ID

Headers

Name
Type
Description

API_KEY_ID

string

Your API Key ID

API_SECRET_KEY

string

Your API Secret Key

[
  {
    "ID": "abcdefgh-abcd-abcd-abcd-24339e5457ff",  // OAuth Token ID
    "created_at": "2020-09-04T04:51:10.778976Z",
    "updated_at": "2020-09-04T04:51:10.778977Z",
    "deleted_at": "0001-01-01T00:00:00Z",
    "company_id": "abcdefgh-abcd-abcd-abcd-f901315ad31b",  // Your API KEY ID
    "user_id": "abcdefgh-abcd-abcd-abcd-22bc178867ef",     // The user's ID
    "provider_user_id": "20483939",                        // User ID from the Provider (Github User ID)
    "provider_username": "putrikarunia",                   // Login/username from the provider (Github Username)
    "identity_provider": "GITHUB",
    "tokens": {                      // OAuth tokens returned by the provider
      "access_token": "abcdefghabcdefghabcdefghabcdefghabcdefg",
      "scope": "repo,user",
      "token_type": "bearer"
    }
  },
  {
    "ID": "abcdefgh-abcd-abcd-abcd-24339e5457ff",  // OAuth Token ID
    "created_at": "2020-09-04T04:51:10.778976Z",
    "updated_at": "2020-09-04T04:51:10.778977Z",
    "deleted_at": "0001-01-01T00:00:00Z",
    "company_id": "abcdefgh-abcd-abcd-abcd-f901315ad31b",  // Your API KEY ID
    "user_id": "abcdefgh-abcd-abcd-abcd-22bc178867ef",     // The user's ID
    "provider_user_id": "20483939",                        // User ID from the Provider (Github User ID)
    "provider_username": "putrikarunia",                   // Login/username from the provider (Github Username)
    "identity_provider": "GOOGLE",
    "tokens": {                      // OAuth tokens returned by the provider
      "access_token": "abcdefghabcdefghabcdefghabcdefghabcdefgh",
      "scope": "repo,user",
      "token_type": "bearer"
    }
  },
  ...
]

Get an Access Token from a Specific Provider for a User

GET https://www.cotter.app/api/v0/oauth/token/:provider_name/:cotter_user_id

Get an access token from one provider for the user.

Path Parameters

Name
Type
Description

cotter_user_id

string

The user's Cotter User ID

provider_name

string

One of: GITHUB

Headers

Name
Type
Description

API_KEY_ID

string

Your API Key ID

API_SECRET_KEY

string

Your API Secret Key

{
  "ID": "abcdefgh-abcd-abcd-abcd-24339e5457ff",  // OAuth Token ID
  "created_at": "2020-09-04T04:51:10.778976Z",
  "updated_at": "2020-09-04T04:51:10.778977Z",
  "deleted_at": "0001-01-01T00:00:00Z",
  "company_id": "abcdefgh-abcd-abcd-abcd-f901315ad31b",  // Your API KEY ID
  "user_id": "abcdefgh-abcd-abcd-abcd-22bc178867ef",     // The user's ID
  "provider_user_id": "20483939",                        // User ID from the Provider (Github User ID)
  "provider_username": "putrikarunia",                   // Login/username from the provider (Github Username)
  "identity_provider": "GITHUB",
  "tokens": {                      // OAuth tokens returned by the provider
    "access_token": "abcdefghabcdefghabcdefghabcdefghabcdefg",
    "scope": "repo,user",
    "token_type": "bearer"
  }
}

Delete an Access Token from a Specific Provider for a User

DELETE https://www.cotter.app/api/v0/oauth/token/:provider_name/:cotter_user_id

Delete an access token from a provider for the user.

Path Parameters

Name
Type
Description

cotter_user_id

string

The user's Cotter User ID

provider_name

string

One of: GITHUB

Headers

Name
Type
Description

API_KEY_ID

string

Your API Key ID

API_SECRET_KEY

string

Your API Secret Key

{
  "ID": "00000000-0000-0000-0000-000000000000",
  "created_at": "0001-01-01T00:00:00Z",
  "updated_at": "2020-09-04T05:09:16.136898006Z",
  "deleted_at": "2020-09-04T05:09:16.13689443Z",
  "company_id": "00000000-0000-0000-0000-000000000000",
  "user_id": "00000000-0000-0000-0000-000000000000",
  "provider_user_id": "",
  "provider_username": "",
  "identity_provider": "",
  "tokens": null
}

Last updated