Auth Sign In and Sign Up
Sign-in and sign-up client methods and route mapping.
Endpoints and Methods
auth.signIn.social()->POST /sign-in/socialauth.signIn.email()->POST /sign-in/emailauth.signIn.username()->POST /sign-in/usernameauth.signUp.email()->POST /sign-up/email
Examples
ATHENA_AUTH_BASE_URL="http://localhost:3001/api/auth"
ATHENA_AUTH_TOKEN="<bearer-token>"
# Adjust payload fields using the OpenAPI schema in this page.
# auth.signIn.social() -> POST /sign-in/social
curl -X POST "$ATHENA_AUTH_BASE_URL/sign-in/social" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.signIn.email() -> POST /sign-in/email
curl -X POST "$ATHENA_AUTH_BASE_URL/sign-in/email" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.signIn.username() -> POST /sign-in/username
curl -X POST "$ATHENA_AUTH_BASE_URL/sign-in/username" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.signUp.email() -> POST /sign-up/email
curl -X POST "$ATHENA_AUTH_BASE_URL/sign-up/email" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'use reqwest::Client;
use serde_json::json;
let base_url = "http://localhost:3001/api/auth";
let token = "<bearer-token>";
let http = Client::new();
// Adjust payload fields using the OpenAPI schema in this page.
// auth.signIn.social() -> POST /sign-in/social
let response = http
.post(format!("{base_url}/sign-in/social"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.signIn.email() -> POST /sign-in/email
let response = http
.post(format!("{base_url}/sign-in/email"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.signIn.username() -> POST /sign-in/username
let response = http
.post(format!("{base_url}/sign-in/username"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.signUp.email() -> POST /sign-up/email
let response = http
.post(format!("{base_url}/sign-up/email"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;import { client } from "./auth-client"
await client.auth.signIn.social({
provider: "google",
callbackURL: "https://app.example.com/auth/callback",
})
await client.auth.signIn.email({
email: "user@example.com",
password: "password",
rememberMe: true,
})
await client.auth.signIn.username({
username: "user1",
password: "password",
rememberMe: true,
})
await client.auth.signUp.email({
name: "New User",
email: "new-user@example.com",
password: "password",
callbackURL: "https://app.example.com/onboarding",
})OpenAPI Contract
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Callback URL to redirect to after the user has signed in
Callback URL to redirect to if an error happens
OAuth2 provider to use
Disable automatic redirection to the provider. Useful for handling the redirection yourself
ID token from the provider to sign in the user with id token
Array of scopes to request from the provider. This will override the default scopes passed.
Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider
The login hint to use for the authorization code request
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/sign-in/social" \ -H "Content-Type: application/json" \ -d '{ "provider": "string" }'{
"redirect": false,
"token": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Email of the user
Password of the user
Callback URL to use as a redirect for email verification
If this is false, the session will not be remembered. Default is true.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/sign-in/email" \ -H "Content-Type: application/json" \ -d '{ "email": "string", "password": "string" }'{
"redirect": false,
"token": "string",
"url": null,
"user": {
"id": "string",
"email": "string",
"name": "string",
"image": "string",
"emailVerified": true,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The username of the user
The password of the user
Remember the user session
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/sign-in/username" \ -H "Content-Type: application/json" \ -d '{ "username": "string", "password": "string" }'{
"token": "string",
"user": {
"id": "string",
"name": "string",
"email": "string",
"emailVerified": true,
"image": "string",
"createdAt": null,
"updatedAt": null,
"username": "string",
"displayUsername": "string",
"twoFactorEnabled": true,
"role": "string",
"banned": true,
"banReason": "string",
"banExpires": null
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The name of the user
The email of the user
The password of the user
The URL to use for email verification callback
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/sign-up/email" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "email": "string", "password": "string" }'{
"token": "string",
"user": {
"id": "string",
"email": "user@example.com",
"name": "string",
"image": "http://example.com",
"emailVerified": true,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}