Catalog108 / challenges / api/auth/jwt-with-refresh
JWT + refresh token flow
What this challenge teaches
Teaches: POST /api/auth/login (System B) → use access_token → when it expires, POST /api/auth/refresh.
Expected output: Successfully fetch /api/auth/me with a JWT obtained via /api/auth/login.
Submit your scraper's JSON output to /challenges/api/auth/jwt-with-refresh/grade
(grader endpoint is part of a later phase; URL is reserved now).
Demo credentials: student@practice.scrapingcentral.com / practice123
# 1. Login → get access + refresh tokens
import requests
r = requests.post("https://practice.scrapingcentral.com/api/auth/login",
json={"email": "student@practice.scrapingcentral.com", "password": "practice123"})
tokens = r.json()
# 2. Use the access token
me = requests.get("https://practice.scrapingcentral.com/api/auth/me",
headers={"Authorization": "Bearer " + tokens["access_token"]}).json()
# 3. After it expires, refresh
new = requests.post("https://practice.scrapingcentral.com/api/auth/refresh",
json={"refresh_token": tokens["refresh_token"]}).json()