LoginΒΆ

Users can submit a /login request, for the programmatic rest-api:

# request attributes
username = 'jeff1evesque'
password = 'password123'
payload = {'user[login]': username, 'user[password]': password}

# login and get flask-jwt token
login = client.post(
    '/login',
    headers={'Content-Type': 'application/json'},
    data=payload
)
token = login.json['access_token']

The returned token, will be required to be supplied on successive requests. For example, supplying a valid token, to the /load-data endpoint:

# request attributes
username = 'jeff1evesque'
password = 'password123'
payload = {'user[login]': username, 'user[password]': password}

# login and get flask-jwt token
login = client.post(
    'https://192.168.99.101:9090/login',
    headers={'Content-Type': 'application/json'},
    data=payload
)
token = login.json['access_token']

# provide flask-jwt token
res = client.post(
    'https://192.168.99.101:9090/load-data',
    headers={
        'Authorization': 'Bearer ' + token,
        'Content-Type': 'application/json'
    },
    data=payload
)

Note: all programmatic rest endpoints (except /login), requires a valid token to be supplied, in order to properly submit a corresponding request.

The following sessions, can be implemented with the above token: