Skip to content

Commit e374ed6

Browse files
authored
Fix Base Account docs (#466)
* update nextjs auth * update auth guide * update html page
1 parent 280bf75 commit e374ed6

3 files changed

Lines changed: 44 additions & 5 deletions

File tree

docs/base-account/guides/authenticate-users.mdx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,38 @@ sequenceDiagram
5555

5656
## Implementation
5757

58+
### Install Dependencies
59+
60+
Make sure to install the dependencies:
61+
62+
<CodeGroup>
63+
```bash
64+
npm install @base-org/account @base-org/account-ui
65+
```
66+
67+
```bash
68+
pnpm add @base-org/account @base-org/account-ui
69+
```
70+
71+
```bash
72+
yarn add @base-org/account @base-org/account-ui
73+
```
74+
75+
```bash
76+
bun add @base-org/account @base-org/account-ui
77+
```
78+
79+
</CodeGroup>
80+
5881
### Code Snippets
5982

6083
<CodeGroup>
6184
```ts Browser (SDK)
6285
import { createBaseAccountSDK } from "@base-org/account";
6386
import crypto from 'crypto';
6487

65-
// Initialize the SDK (no config needed for defaults)
66-
const provider = createBaseAccountSDK().getProvider();
88+
// Initialize the SDK
89+
const provider = createBaseAccountSDK({appName: 'My App'}).getProvider();
6790

6891
// 1 — get a fresh nonce (generate locally or prefetch from backend)
6992
const nonce = window.crypto.randomUUID().replace(/-/g, '');

docs/base-account/quickstart/web.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ You can use the Base Account SDK in two ways:
1616
### Option A: CDN (No installation required)
1717
Just include the script tag in your HTML - no build tools needed!
1818

19+
```html index.html
20+
[...rest of your code]
21+
<script src="https://unpkg.com/@base-org/account/dist/base-account.min.js"></script>
22+
[...rest of your code]
23+
```
24+
For a full example, see [example](#2-copy-paste-this-html-file) below.
25+
1926
### Option B: NPM Package
2027
If you prefer to install locally:
2128

docs/base-account/reference/ui-elements/sign-in-with-base-button.mdx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,16 @@ function SignInWithErrorHandling() {
433433

434434
### NextAuth.js Integration
435435

436-
```tsx
437-
// pages/api/auth/[...nextauth].js
436+
Below is an example of how to configure NextAuth to use Base Account as a credentials provider, so you can use Base Account in your Next.js application.
437+
438+
<Note>
439+
**NextAuth.js Integration**
440+
441+
[Next.js](https://nextjs.org/) is a popular React framework, and [NextAuth.js](https://next-auth.js.org/) is an authentication library for Next.js. It offers session management and providers.
442+
</Note>
443+
444+
```tsx pages/api/auth/[...nextauth].js expandable
445+
438446
import NextAuth from 'next-auth'
439447
import CredentialsProvider from 'next-auth/providers/credentials'
440448
import { verifyMessage } from 'viem'
@@ -471,7 +479,8 @@ export default NextAuth({
471479
}),
472480
],
473481
});
474-
482+
```
483+
```tsx page.tsx expandable
475484
// Frontend component
476485
import { signIn } from 'next-auth/react';
477486

0 commit comments

Comments
 (0)