Authentication Methods
In the Graphistry 2.0 REST API, authentication is crucial for security and access control. Currently, there are three methods to obtain JWT tokens:
- Username and Password
- Personal API Key
- Single Sign-On (SSO)
1. Password Authentication
Use your account credentials to get a short-lived token (~1 hour). This token is required for performing REST API actions. Tokens are valid for up to 24 hours, requiring daily re-login with full credentials. For more information, see Personal API Key Authentication and Single Sign-On (SSO) Authentication.
2. Personal API Key Authentication
To authenticate using a personal API key:
- Navigate to your profile menu and select "Manage API Keys".
- Generate a Personal Key ID and Secret Key. Note: The Personal Secret Key will not be visible again after leaving this screen.
- Use the Personal Key ID and Secret Key to authenticate by making a POST request with the following format:
curl -X POST -H "Authorization: PersonalKey ${PERSONAL_KEY_ID}:${PERSONAL_KEY_SECRET}" https://${GRAPHISTRY_HOST}/api/v2/auth/pkey/jwt/
This request will return a JWT token that can be used for subsequent API requests.
3. Global Single Sign-On (SSO)
SSO authentication redirects you to the site-wide SSO system for login.
4. Single Sign-On (SSO) with Organization (IDP)
For organizations using IDP (Identity Provider) with SSO, the authentication process involves two steps and two API calls:
- Initiate SSO Authentication: The first step is to initiate the SSO authentication process for your organization. This is done by making a GET request to the SSO login API endpoint. This request will redirect you to the organization's SSO login page.
- Retrieve the JWT Token: After successfully logging in through the SSO system, you will receive a response that includes a 'state' parameter. This 'state' is a unique identifier for your session. You then use this 'state' to make a second API call to retrieve your JWT token.
Using REST API for Authentication
Below are examples of REST API calls for each authentication method:
Route | Method | Headers | Parameters | Return |
---|---|---|---|---|
api/v2/auth/pkey/jwt/ |
POST | Authorization: PersonalKey PERSONAL_KEY_ID:PERSONAL_KEY_SECRET | Personal Key ID, Personal Secret Key | {"token": str} |
Input:
Note: Replace "YOUR_ORG_NAME" with the actual name of your organization. This parameter is optional. |
||||
api/v2/g/sso/oidc/login |
GET | N/A | N/A | Redirect to SSO login page |
Input:
|
||||
sso/oidc/login/idp_name/ |
GET | N/A | N/A | Redirect to SSO login page |
Input:
|
||||
/sso/oidc/jwt/{state}/ |
GET | N/A | N/A | N/A |
Input:
|
For further details and language-specific implementations, please refer to our Python client library documentation.