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
Get a List of Access Tokens from All Social Logins for a User

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.
Request
Response
Request
Path Parameters
cotter_user_id
required
string
The user's Cotter User ID
Headers
API_KEY_ID
required
string
Your API Key ID
API_SECRET_KEY
required
string
Your API Secret Key
Response
200: OK
A list of OAuth Tokens from each provider that is associated with the user.
[
{
"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
Get an Access Token from a Specific Provider for a User

https://www.cotter.app/api/v0/oauth/token/:provider_name/:cotter_user_id
Get an access token from one provider for the user.
Request
Response
Request
Path Parameters
cotter_user_id
required
string
The user's Cotter User ID
provider_name
required
string
One of: GITHUB
Headers
API_KEY_ID
required
string
Your API Key ID
API_SECRET_KEY
required
string
Your API Secret Key
Response
200: OK
A Token Object with the OAuth tokens from the provider for the user.
{
"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
Delete an Access Token from a Specific Provider for a User

https://www.cotter.app/api/v0/oauth/token/:provider_name/:cotter_user_id
Delete an access token from a provider for the user.
Request
Response
Request
Path Parameters
cotter_user_id
optional
string
The user's Cotter User ID
provider_name
optional
string
One of: GITHUB
Headers
API_KEY_ID
optional
string
Your API Key ID
API_SECRET_KEY
optional
string
Your API Secret Key
Response
200: OK
{
"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
}