Rightwork OG Image
Browse API documentation
API docsLegacy API

Getting an access token

Exchange the username and password supplied by Rightwork for a legacy access token.

Request

POST https://getrightwork.dev/api/dj-rest-auth/login/

JSON
{
  "username": "<your-username>",
  "password": "<your-password>"
}

A successful response contains the token in key. Store it securely and send it in the header Authorization: Token <your-access-token> on subsequent legacy requests.

Python example

Python
import requests

def get_access_token(username, pwd):
    url = "https://getrightwork.dev/api/dj-rest-auth/login/"
    payload = {
        'username': username,
        'password': pwd,
    }
    response = requests.post(url, data=payload)
    if response.status_code == 200:
        return response.json()['key']
    else:
        raise Exception(f"Failed to obtain access token: {response.status_code} - {response.text}")

# Example usage:
username = "your-username"
password = "your-password"
access_token = get_access_token(username, password)
# Use access_token in subsequent requests.