stack/docs-mintlify/api/client/oauth/authorize.mdx
Madison 13fccd32b6
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
DB migration compat / Check if migrations changed (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Build and Run / docker (push) Has been cancelled
Runs E2E API Tests (Local Emulator) / E2E Tests (Local Emulator, Node ${{ matrix.node-version }}) (22.x) (push) Has been cancelled
Runs E2E API Tests / E2E Tests (Node ${{ matrix.node-version }}, Freestyle ${{ matrix.freestyle-mode }}) (mock, 22.x) (push) Has been cancelled
Runs E2E API Tests / E2E Tests (Node ${{ matrix.node-version }}, Freestyle ${{ matrix.freestyle-mode }}) (prod, 22.x) (push) Has been cancelled
Runs E2E API Tests with custom port prefix / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Dev Environment Test With Custom Base Port / restart-dev-and-test-with-custom-base-port (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests with custom base port / setup-tests-with-custom-base-port (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
DB migration compat / Back-compat — Current branch migrations with ${{ needs.check-migrations-changed.outputs.base_branch }} branch code (push) Has been cancelled
DB migration compat / Forward-compat — Current branch code with ${{ needs.check-migrations-changed.outputs.base_branch }} branch migrations (push) Has been cancelled
DB migration compat / No migration changes (skipped) (push) Has been cancelled
Add docs-mintlify to root
2026-04-01 14:58:41 -05:00

89 lines
2.4 KiB
Plaintext

---
title: "OAuth Authorize"
description: "Initiate an OAuth authorization flow for user authentication or linking with an OAuth provider."
api: "GET /api/v1/auth/oauth/authorize/{provider_id}"
---
## Request
<ParamField header="x-stack-publishable-client-key" type="string" required>
The publishable client key for authentication.
</ParamField>
<ParamField header="x-stack-project-id" type="string" required>
The project ID.
</ParamField>
<ParamField path="provider_id" type="string" required>
The OAuth provider identifier (e.g., `google`, `github`).
</ParamField>
<ParamField query="type" type="string">
The type of OAuth flow (e.g., `authenticate` or `link`).
</ParamField>
<ParamField query="token" type="string">
An authentication token, used when linking an OAuth provider to an existing user.
</ParamField>
<ParamField query="provider_scope" type="string">
Additional OAuth scopes to request from the provider.
</ParamField>
<ParamField query="error_redirect_uri" type="string">
The URI to redirect to if an error occurs during the OAuth flow.
</ParamField>
<ParamField query="after_callback_redirect_url" type="string">
The URL to redirect to after the OAuth callback completes.
</ParamField>
<ParamField query="client_id" type="string">
The OAuth client ID.
</ParamField>
<ParamField query="client_secret" type="string">
The OAuth client secret.
</ParamField>
<ParamField query="redirect_uri" type="string">
The redirect URI for the OAuth flow.
</ParamField>
<ParamField query="scope" type="string">
The OAuth scopes to request.
</ParamField>
<ParamField query="state" type="string">
The OAuth state parameter for CSRF protection.
</ParamField>
<ParamField query="grant_type" type="string">
The OAuth grant type.
</ParamField>
<ParamField query="code_challenge" type="string">
The PKCE code challenge.
</ParamField>
<ParamField query="code_challenge_method" type="string">
The PKCE code challenge method (e.g., `S256`).
</ParamField>
<ParamField query="response_type" type="string">
The OAuth response type (e.g., `code`).
</ParamField>
## Response
Returns a `302` redirect response to the OAuth provider's authorization page.
<CodeGroup>
```bash cURL
curl -X GET 'https://api.stack-auth.com/api/v1/auth/oauth/authorize/google?after_callback_redirect_url=https://example.com/callback' \
-H 'x-stack-publishable-client-key: YOUR_PUBLISHABLE_CLIENT_KEY' \
-H 'x-stack-project-id: YOUR_PROJECT_ID' \
-L
```
</CodeGroup>