Skip to content

Commit

Permalink
docs: edits
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrenon committed Feb 20, 2025
1 parent d0b21bf commit 65531df
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 6 deletions.
45 changes: 42 additions & 3 deletions content/docs/guides/neon-auth-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Manage Neon Auth using the API
enableTableOfContents: true
---

Learn how to manage your Neon Auth integration using the Neon API. Create a new integration, add users, and claim ownership of your Neon-managed auth project to your auth provider.
Learn how to manage your Neon Auth integration using the Neon API. Create a new integration, generate SDK keys, add users, and claim ownership of your Neon-managed auth project to your auth provider.

## Prerequisites

Expand Down Expand Up @@ -95,6 +95,41 @@ Example response:

[Try in API Reference ↗](https://api-docs.neon.tech/reference/listProjectIdentityIntegrations)

## Generate SDK keys

Generates SDK keys for your auth provider integration. These keys are used to set up your frontend and backend SDKs.

Required parameters:

- `project_id`: Your Neon project ID
- `auth_provider`: The authentication provider (currently `"stack"`)

```bash shouldWrap
curl --request POST \
--url 'https://console.neon.tech/api/v2/projects/auth/keys' \
--header 'authorization: Bearer $NEON_API_KEY' \
--header 'content-type: application/json' \
--data '{
"project_id": "project-id",
"auth_provider": "stack"
}' | jq
```

Example response:
```json shouldWrap
{
"auth_provider": "stack",
"auth_provider_project_id": "project-id-123",
"pub_client_key": "pck_example...",
"secret_server_key": "ssk_example...",
"jwks_url": "https://api.stack-auth.com/api/v1/projects/project-id-123/.well-known/jwks.json",
"schema_name": "neon_auth",
"table_name": "users_sync"
}
```

[Try in API Reference ↗](https://api-docs.neon.tech/reference/createProjectIdentityAuthProviderSDKKeys)

## Create users

Creates a new user in your auth provider's system.
Expand All @@ -104,7 +139,10 @@ Required parameters:
- `project_id`: Your Neon project ID
- `auth_provider`: The authentication provider (currently `"stack"`)
- `email`: User's email address
- `password`: User's password

Optional parameters:

- `name`: User's display name (1-255 characters)

```bash shouldWrap
curl --request POST \
Expand All @@ -115,7 +153,7 @@ curl --request POST \
"project_id": "project-id",
"auth_provider": "stack",
"email": "[email protected]",
"password": "secure-password"
"name": "Example User"
}' | jq
```

Expand Down Expand Up @@ -181,3 +219,4 @@ curl --request DELETE \
```

[Try in API Reference ↗](https://api-docs.neon.tech/reference/deleteProjectIdentityIntegration)

37 changes: 34 additions & 3 deletions content/docs/guides/neon-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,41 @@ Choose your setup option in the Neon Console under the **Auth** page.

## Transfer ownership

When you create a Neon Auth integration using Quick Start, Neon manages the auth project for you. You can claim ownership of the project to your own Stack Auth account by clicking **Transfer ownership** in the **Auth** page. This gives you direct access to manage your project in the Stack Auth dashboard while maintaining the integration with your Neon database.
When you create a Neon Auth integration using the **Quick Start** option from the **Auth** page (or using the [Create integration API](/docs/guides/neon-auth-api#create-integration)), Neon manages the auth project for you.

<Tabs labels={["Neon Console", "API"]}>

<TabItem>

You can claim ownership of the project to your own Stack Auth account by clicking **Transfer ownership** in the **Auth** page.

![The Transfer ownership button appears when your integration is Neon managed](/docs/guides/auth-transfer-ownership.png)

This opens a transfer confirmation page where you can select which Stack Auth account should receive ownership of the project. After confirming the transfer, you'll have direct access to manage your project in the Stack Auth dashboard while maintaining the integration with your Neon database.

</TabItem>

<TabItem>

Request a transfer URL using the transfer ownership endpoint:

```bash shouldWrap
curl --request POST \
--url 'https://console.neon.tech/api/v2/projects/auth/transfer_ownership' \
--header 'authorization: Bearer $NEON_API_KEY' \
--data '{
"project_id": "project-id",
"auth_provider": "stack"
}'
```

Then open the returned URL in a browser to complete the transfer. See [Transfer ownership using the API](/docs/guides/neon-auth-api#transfer-to-your-auth-provider-optional) for details.

</TabItem>
</Tabs>

<Admonition type="note">
After the transfer, you'll still be able to access your project from the Neon Console, but you'll also have direct access from the Stack Auth dashboard.
After transfer, you'll still be able to access your project from the Neon Console, but you'll also have direct access from the Stack Auth dashboard.
</Admonition>

## Using the API
Expand All @@ -160,9 +191,9 @@ You can manage your Neon Auth integration programmatically using the API. This i
Key operations:

- Create a Neon-managed auth integration
- Generate SDK keys for your integration
- Create users in your auth provider
- Transfer ownership to your auth provider
- List and manage integrations

See [Manage Neon Auth using the API](/docs/guides/neon-auth-api) for details.

Expand Down
Binary file added public/docs/guides/auth-transfer-ownership.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 65531df

Please sign in to comment.