Cotter
  • 🚀Getting Started
  • Features & Concepts
    • 💬Sign In with Email/Phone Number
    • 🔐Sign In with Device
      • How it works
    • 🧬Sign In with WebAuthn
  • 📌Quickstart Guides
    • All Guides & Tutorials
    • HTML – Sign in with Email/Phone
    • React – Sign in with Email/Phone
    • React – WebAuthn
    • ▲ Next.js
    • Angular
    • Webflow
    • Bubble.io
    • Python SDK for a CLI
    • React Native – Sign in with Device
    • iOS – Sign in with Device
    • Flutter – Sign in with Device
  • 📘SDK Reference
    • Web
      • Sign In with Email/Phone Number
        • Customize the Form
        • Checking the email or phone before sending a verification code
        • Sending Code or Link via WhatsApp
        • Styling
        • Older SDK
          • Customize the Form
      • Sign in with Social Login
        • Getting Access Tokens from Social Login Providers
        • Github Instructions
        • Google Instructions
      • Sign In with WebAuthn
        • Register WebAuthn for a logged-in user
      • Sign In with Device
        • Steps for Pop Up Authentication Prompt
        • Advanced Customization for Login Form
        • Advanced Customization for Pop Up Authentication Prompt
      • Getting Access Token and Logged-In User Info
      • Sending Successful Form Submission
      • FAQ & Troubleshooting
    • React Native
      • Installation
      • Sign In with Device
        • Add Email/Phone Verification
        • Authenticate from a Non-Trusted Device
        • Add a new Trusted Device
        • Remove Trusted Device
      • Sign In with Email/Phone Number
      • Getting Stored OAuth Tokens and User Information
      • FAQ
      • Older SDK Versions
        • Sign in with Email/Phone
        • Sending Code via WhatsApp
        • Sign In with Device
          • Authenticate from a Non-Trusted Device
          • Add a new Trusted Device
          • Customization
    • Flutter
      • Sign In with Device
        • Add Email/Phone Verification
        • Authenticate from a Non-Trusted Device
      • Sign in with Email/Phone Number
      • Getting the Logged-in User
      • Getting OAuth Tokens
      • Signing a User Out
    • iOS
      • Sign In with Email/Phone Number
      • Sign In with Device
        • Authenticate from a Non-Trusted Device
        • Push Notification
        • Check if Trusted Device is Enrolled
        • Add a New Trusted Device
        • Remove Trusted Device
      • Older Versions
        • Biometric/Pin
    • Android
      • Sign In with Device
        • Authenticate from a Non-Trusted Device
        • Check if Trusted Device is Enrolled
        • Add a new Trusted Device
        • Remove Trusted Device
        • Customization
      • Sign In with Email/Phone Number
      • Biometric/Pin
        • Advanced Methods
        • Customization
        • Setting Strings
        • Styling
      • Older SDK Version
        • Sign In with Device
          • Authenticate from a Non-Trusted Device
    • Python (for CLI)
    • API for Other Mobile Apps or CLI
      • Verify Email/Phone Number
        • Handling URL Scheme
    • Backend: Handling Response
  • 🛡️ Protecting Your Account
    • Only Allow Your Website/App to Use Your API Key
    • Rate Limit
    • Enable reCAPTCHA to Protect Against Automated Abuse
  • 🗝️ Getting Access Token
    • Cotter's OAuth 2.0 Tokens Specification
    • Getting the Tokens
      • Get Tokens during Authentication
      • Using the Refresh Token
    • Storing and Removing Tokens
    • Renewing Expired Tokens
    • Verifying JWT Tokens
    • Requesting Custom Fields on your JWT Token
    • Older API
      • Using HTTP Requests
      • Getting the Tokens
        • During Authentication
          • During Email/Phone Verification
        • During enrolling Trusted Devices
  • 🔌API Reference
    • User API
      • User Object
    • OAuth Tokens API
      • Verify JWT Token using API (serverless)
      • Requesting Custom Claims on your Access Token
      • Older API
    • OAuth Tokens from Social Login
    • Event Object
    • Reset PIN API
  • Older API
    • Validating Cotter's Identity Token
    • Validating Cotter's Event Response
Powered by GitBook
On this page
  • Get a List of Access Tokens from All Social Logins for a User
  • Get an Access Token from a Specific Provider for a User
  • Delete an Access Token from a Specific Provider for a User
  1. SDK Reference
  2. Web
  3. Sign in with Social Login

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
}
PreviousSign in with Social LoginNextGithub Instructions

Last updated 4 years ago

📘