Athena

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/social
  • auth.signIn.email() -> POST /sign-in/email
  • auth.signIn.username() -> POST /sign-in/username
  • auth.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

POST
/sign-in/social

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

callbackURL?string

Callback URL to redirect to after the user has signed in

newUserCallbackURL?string
errorCallbackURL?string

Callback URL to redirect to if an error happens

provider*string

OAuth2 provider to use

disableRedirect?string

Disable automatic redirection to the provider. Useful for handling the redirection yourself

idToken?string

ID token from the provider to sign in the user with id token

scopes?string

Array of scopes to request from the provider. This will override the default scopes passed.

requestSignUp?string

Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider

loginHint?string

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"
}
POST
/sign-in/email

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

email*string

Email of the user

password*string

Password of the user

callbackURL?string

Callback URL to use as a redirect for email verification

rememberMe?string

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"
}
POST
/sign-in/username

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

username*string

The username of the user

password*string

The password of the user

rememberMe?string

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"
}
POST
/sign-up/email

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

name*string

The name of the user

email*string

The email of the user

password*string

The password of the user

callbackURL?string

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"
}