Skip to main content

Auth API

strapi

  • Login /api/auth/local
  • /connect/github/redirect
  • /api/connect/${provider}
  • /api/auth/${provider}/callback
  • /api/auth/forgot-password
  • /api/auth/reset-password
  • /api/auth/send-email-confirmation
  • /api/auth/email-confirmation?confirmation=TOKEN
POST /api/auth/local/register
{
"username": "Strapi user",
"email": "[email protected]",
"password": "strapiPassword"
}

修改密码

POST /api/auth/change-password
{
"currentPassword": "currentPassword",
"password": "userNewPassword",
"passwordConfirmation": "userNewPassword"
}

directus

access token

  • by header
  • by cookie
  • by query
Authorization: Bearer <token>
Cookie: directus_session_token=<token>
?access_token=<token>

login

POST /auth/login
POST /auth/login/provider
{
"email": "[email protected]",
"password": "password",
"otp": "123456",
"mode": "jsoncookie|session"
}
{
"access_token": "",
"expires": 7200,
"refresh_token": ""
}

refresh

POST /auth/refresh
{
"refresh_token": "refresh_token_string",
"mode": "json|cookie|session"
}
{
"access_token": "",
"expires": 7200,
"refresh_token": ""
}

logout

POST /auth/logout
{
"refresh_token": "refresh_token",
"mode": "json"
}

password reset

POST /auth/password/request
{
"email": "user_email",
"reset_url": ""
}
POST /auth/password/reset
{
"token": "password_reset_token",
"password": "password"
}

providers

GET /auth
{
"data": [
{
"name": "GitHub",
"driver": "oauth2",
"icon": "github"
},
{
"name": "Google",
"driver": "openid",
"icon": "google"
},
{
"name": "Okta",
"driver": "openid"
}
],
"disableDefault": false
}