Powered by Tejo

Tejo Developer: CSRF Tokens

 

About 

This page discusses CSRF Tokens.

A list of APIs:

Order API

CSRF Token

To make any request you need to login and get a CSRF token. You do this you need to make a POST request to:

https://tejo.ca/user/login?_format=json 
headers = {'Content-Type' : 'application/json'}
data = {'name' : username, 'pass' : password}

The response you get will include your 'csrf_token'.

You can find your username (Not your e-mail) and change your password here.

Rest Request

To make a request be sure to include the token in the header.

 'headers' : {
        'Content-Type' : 'application/json',
        'X-CSRF-Token' : Your Token,
      }

Sample Code

Sample Python Code:

 

import requests, base64, json, re
from pprint import pprint

response = requests.get(
    'https://tejo.ca/login?_format=json',
    params={'name' : username, 'pass' : password},
    headers={'Content-Type' : 'application/json'},
)

json_response = response.json()

 

 

Tejo runs on Drupal 8. You can always consult D8 documentation for more information.