DevTools

JWT Auth flow

This flow logs in, captures a JWT from the response, and uses it in a follow-up request. Use it for smoke tests and regression checks where auth is the first step.

Required env vars

How to run it

devtools flow run jwt-auth.yaml
TODO:
# jwt-auth.yaml
version: 1
name: JWT login and use
env:
  API_BASE: https://api.example.com
  LOGIN_EMAIL: {{#env:LOGIN_EMAIL}}
  LOGIN_PASSWORD: {{#env:LOGIN_PASSWORD}}

requests:
  - id: auth_login
    name: Login
    method: POST
    url: {{ env.API_BASE }}/login
    body:
      json:
        email: {{ env.LOGIN_EMAIL }}
        password: {{ env.LOGIN_PASSWORD }}
    expect:
      - status: 200

  - id: get_profile
    name: Get profile
    method: GET
    url: {{ env.API_BASE }}/me
    headers:
      Authorization: Bearer {{ auth_login.response.body.token }}
    expect:
      - status: 200

What to change

Common variations

Links