Skip to content

Commit 3aac998

Browse files
authored
Merge branch 'main' into docs/write-0-10-docs
2 parents ea51698 + b5af548 commit 3aac998

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

docs/guide/application-side/session-access.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ await signIn(credentials, { callbackUrl: '/protected' })
210210

211211
// Trigger a signIn with a redirect to an external page afterwards
212212
await signIn(credentials, { callbackUrl: 'https://nuxt.org', external: true })
213+
214+
// Trigger a signIn without calling getSession directly. You have to manually call it to get session data.
215+
await signIn(credentials, { callGetSession: false })
213216
```
214217

215218
:::
@@ -321,6 +324,7 @@ setToken('new token')
321324
// Helper method to quickly delete the token cookie (alias for rawToken.value = null)
322325
clearToken()
323326
```
327+
324328
:::
325329

326330
:::warning Local provider:

docs/guide/getting-started/installation.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22

33
You can install NuxtAuth using nuxi:
44

5-
```bash
6-
npx nuxi@latest module add sidebase-auth
5+
::: code-group
6+
7+
```bash [npm]
8+
npx nuxi module add sidebase-auth
9+
```
10+
11+
```bash [pnpm]
12+
pnpm exec nuxi module add sidebase-auth
713
```
814

15+
```bash [yarn]
16+
yarn dlx nuxi module add sidebase-auth
17+
```
18+
19+
:::
20+
921
::: details Manual installation
1022

1123
::: code-group
@@ -19,7 +31,7 @@ pnpm i -D @sidebase/nuxt-auth
1931
```
2032

2133
```bash [yarn]
22-
yarn add --dev @sidebase/nuxt-auth
34+
yarn add -D @sidebase/nuxt-auth
2335
```
2436

2537
:::
@@ -31,7 +43,7 @@ Add NuxtAuth to your `nuxt.config`:
3143
```ts [nuxt.config.ts]
3244
export default defineNuxtConfig({
3345
modules: [
34-
'@sidebase/nuxt-auth',
46+
'@sidebase/nuxt-auth'
3547
],
3648
})
3749
```

src/runtime/composables/local/useAuth.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ const signIn: SignInFunc<Credentials, any> = async (credentials, signInOptions,
5555
rawRefreshToken.value = extractedRefreshToken
5656
}
5757

58-
await nextTick(getSession)
58+
const { redirect = true, external, callGetSession = true } = signInOptions ?? {}
59+
60+
if (callGetSession) {
61+
await nextTick(getSession)
62+
}
5963

60-
const { redirect = true, external } = signInOptions ?? {}
6164
let { callbackUrl } = signInOptions ?? {}
6265
if (typeof callbackUrl === 'undefined') {
6366
const redirectQueryParam = useRoute()?.query?.redirect

src/runtime/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,12 @@ export interface SecondarySignInOptions extends Record<string, unknown> {
574574
* @default false
575575
*/
576576
external?: boolean
577+
/**
578+
* Whether `getSession` needs to be called after a successful sign-in. When set to false, you can manually call `getSession` to obtain the session data.
579+
*
580+
* @default true
581+
*/
582+
callGetSession?: boolean
577583
}
578584

579585
export interface SignUpOptions extends SecondarySignInOptions {

0 commit comments

Comments
 (0)