Skip to main content
POST
/
auth
/
oauth2
/
init
curl --request POST \
  --url https://{deploymentHost}/auth/oauth2/init \
  --header 'Content-Type: application/json' \
  --data '{
  "provider": "google"
}'
{
  "status": 200,
  "message": "",
  "data": {
    "authorization_url": "https://accounts.google.com/oauth/authorize?client_id=example&redirect_uri=https%3A%2F%2Fyour-deployment.wacht.dev%2Fauth%2Foauth2%2Fcallback&response_type=code&scope=openid+email+profile&state=oauth_state_token_123",
    "state": "oauth_state_token_123"
  },
  "session": {
    "signin_attempts": [],
    "signins": [],
    "signup_attempts": [],
    "active_signin": null
  },
  "errors": []
}

Authorizations

__session
string
cookie
required

Session cookie authentication for production deployments. The session token is automatically set as an HTTP-only, secure cookie.

Body

application/json
provider
enum<string>
required

OAuth2 provider to authenticate with

Available options:
google,
github,
microsoft
redirect_url
string

URL to redirect after OAuth completion (optional)

Response

OAuth2 authorization URL generated

status
integer
required

HTTP status code

message
string
required

Response message (empty for success)

data
any
required

Response data (can be any type)

session
object
required
errors
object[]
required

Array of error objects (empty for success)