TNID
  • Welcome
  • Getting Started
    • Company Authentication
    • User Authentication
    • Accessing via Postman / GraphQL Schema examples
  • Company
    • Search Companies
    • Invite Company
    • List Organization Types
    • List Vertical Types
    • Update Company Profile
    • B2B Features
      • Send B2B Connection Request
      • List B2B Connections
      • List Pending B2B Connection Requests
      • Cancel B2B Connection Request
      • Get Received B2B Connection Requests
      • Respond to B2B Connection Requests
    • B2C Features
      • List B2C (People) Connections
      • List Pending People Connection Requests
      • List Active Subscribers
      • List Pending Subscription Requests
      • Send Person (B2C) Connection Request
      • Invite People (as Company)
      • Send Person (B2C) Subscription Request
      • Cancel Pending B2C Connection Request
      • Cancel Pending B2C Subscription Request
      • Get Pending Connection Requests (People)
      • Respond to C2B Connection Request
      • Get Connected People
      • Search People
      • List Opt-Out Requests
      • Create Opt-out Request
  • User
    • Update User profile
    • Search User (People)
    • Invite User (People)
    • Connections
      • Send C2B Connection Request
      • List B2C connections
      • List received pending B2C Connection Requests
      • Respond to received B2C Connection Request
      • Revoke sent C2B Connection Request
      • List sent pending C2B Connection Requests
    • Spam Reporting Features
      • Create Spam Report
      • List Spam Reports
    • Company Features
      • Search Companies
      • Create company profile
      • List Pending C2C Connection Requests
      • Revoke sent C2C Connection Request
      • List Received C2C Connection Requests
      • Send C2C Connection Request
      • Respond C2C Connection Request
      • List C2C Connections
  • Group Features
    • Search Groups
    • List User's Groups
    • Create Group
    • Update group
    • Invite User to Group
    • Respond to Group invite
    • List pending Group invites (Sent)
    • List pending Group invites (Received)
    • Revoke Pending Group User Member Invite
    • Send Group user member join request
    • List Received Pending Group user member join request
    • List Pending Group user member join request
    • Revoke Group user member join request
    • Respond to Group user member join request
Powered by GitBook
On this page
  • Generate Your Bearer Token
  • Example Company authentication using various languages

Was this helpful?

  1. Getting Started

Company Authentication

Learn how to get your Company TNID client key and secret to authenticate into the GraphQL API.

PreviousWelcomeNextUser Authentication

Last updated 8 months ago

Was this helpful?

Company users of TNID are currently able to generate Client Secrets so that they can access the API. To create a Company, first register as an Individual, and then create a Company associated with your Individual profile. Then, assume the role of your Company and click "New Client Secret" in order to create your credentials.

You are only allowed to view your Client Secret value at creation, so please ensure you save it someplace safe (e.g. 1Password or your environment variables). You will not be able to see it once you close the pop-up (however, you can always create a new Client Secret.

We do not expire tokens or force password resets at any time. We follow the latest NIST guidelines and believe in a strong, lengthy secure password protocol. Create new Client Secrets if you believe there is evidence of a compromise.

Generate Your Bearer Token

The below URLs are available to create your API token, depending on your environment:

Simply pass the client_id and client_secret data to generate your Bearer token for future API requests:

{
   "client_id": CLIENT_ID_VALUE,
   "client_secret": CLIENT_SECRET_VALUE
}

Use the access_token from the response to interact with the GraphQL api at /company.

Example Company authentication using various languages

import requests

def get_bearer_token(client_id, client_secret):
    url = "https://api.staging.v2.tnid.com/auth/token"
    
    # Define the headers and body of the request
    headers = {
        "Content-Type": "application/x-www-form-urlencoded"
    }
    
    # The payload or data to be sent in the POST request
    data = {
        "client_id": client_id,
        "client_secret": client_secret
    }
    
    # Make the POST request to the token endpoint
    response = requests.post(url, headers=headers, data=data)
    
    # Check if the request was successful
    if response.status_code == 200:
        # Parse the response and extract the access token
        token_data = response.json()
        return token_data.get("access_token")
    else:
        raise Exception(f"Failed to retrieve token: {response.status_code} {response.text}")

# Example usage:
client_id = "your_client_id"      # Replace with your actual client ID
client_secret = "your_client_secret"  # Replace with your actual client secret

token = get_bearer_token(client_id, client_secret)
print("Bearer Token:", token)

https://api.demo.v2.tnid.com/auth/tokenapi.demo.v2.tnid.com
Demo / Beta Environment
https://api.staging.v2.tnid.com/auth/tokenapi.staging.v2.tnid.com
Staging Environment
Screenshot of Client Secrets section in GUI