Skip to content

Commit 5cf6928

Browse files
authored
Merge branch 'main' into main
2 parents 808efb1 + baa15f4 commit 5cf6928

File tree

6 files changed

+17
-44
lines changed

6 files changed

+17
-44
lines changed

docs/pages/getting-started/providers/google.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Alternatively, you can also pass options in the `params` object of `authorizatio
111111

112112
If you need access to the RefreshToken or AccessToken for a Google account and you are not using a database to persist user accounts, this may be something you need to do.
113113

114-
```ts filename="app/api/auth/[...nextauth]/route.ts"
114+
```ts filename="./auth.ts"
115115
import Google from "next-auth/providers/google"
116116

117117
export const { handlers, auth, signIn, signOut } = NextAuth({

docs/pages/guides/pages/signin.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Screenshot } from "@/components/Screenshot"
55

66
To add a custom sign-in page, you'll need to define the path to your page in the [`pages`](/reference/core/types#pagesoptions) object in your Auth.js configuration. Make sure a route / page actually exists at the path you're defining here!
77

8-
In additionally, we'll have to export a map of `provider.id` and `provider.name` to easily consume in our custom page if we want to dynamically render the correct buttons, based on what we've defined in our `auth.ts` configuration. Because you can pass your providers to the `providers` array as both a function, or the result of calling that function, this example `providerMap` handles both cases.
8+
Additionally, we'll have to export a map of `provider.id` and `provider.name` to easily consume in our custom page if we want to dynamically render the correct buttons, based on what we've defined in our `auth.ts` configuration. Because you can pass your providers to the `providers` array as both a function, or the result of calling that function, this example `providerMap` handles both cases.
99

1010
<Code>
1111
<Code.Next>

packages/adapter-prisma/src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
*
1616
* @module @auth/prisma-adapter
1717
*/
18-
import { type PrismaClient } from "@prisma/client"
19-
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library"
18+
import { Prisma, type PrismaClient } from "@prisma/client"
2019
import type {
2120
Adapter,
2221
AdapterAccount,
@@ -90,7 +89,7 @@ export function PrismaAdapter(
9089
// If token already used/deleted, just return null
9190
// https://www.prisma.io/docs/reference/api-reference/error-reference#p2025
9291
if (
93-
error instanceof PrismaClientKnownRequestError &&
92+
error instanceof Prisma.PrismaClientKnownRequestError &&
9493
error.code === "P2025"
9594
)
9695
return null

packages/core/src/errors.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ type ErrorType =
4141
* @noInheritDoc
4242
*/
4343
export class AuthError extends Error {
44-
/** The error type. Used to identify the error in the logs.
45-
* @internal
46-
*/
4744
type: ErrorType
4845
/**
4946
* Determines on which page an error should be handled. Typically `signIn` errors can be handled in-page.
@@ -52,7 +49,6 @@ export class AuthError extends Error {
5249
*/
5350
kind?: "signIn" | "error"
5451

55-
/** @internal */
5652
cause?: Record<string, unknown> & { err?: Error }
5753

5854
/** @internal */
@@ -108,7 +104,6 @@ export class SignInError extends AuthError {
108104
* @noInheritDoc
109105
*/
110106
export class AdapterError extends AuthError {
111-
/** @internal */
112107
static type = "AdapterError"
113108
}
114109

@@ -118,7 +113,6 @@ export class AdapterError extends AuthError {
118113
* @noInheritDoc
119114
*/
120115
export class AccessDenied extends AuthError {
121-
/** @internal */
122116
static type = "AccessDenied"
123117
}
124118

@@ -163,7 +157,6 @@ export class AccessDenied extends AuthError {
163157
* @noInheritDoc
164158
*/
165159
export class CallbackRouteError extends AuthError {
166-
/** @internal */
167160
static type = "CallbackRouteError"
168161
}
169162

@@ -177,7 +170,6 @@ export class CallbackRouteError extends AuthError {
177170
* @noInheritDoc
178171
*/
179172
export class ErrorPageLoop extends AuthError {
180-
/** @internal */
181173
static type = "ErrorPageLoop"
182174
}
183175

@@ -191,7 +183,6 @@ export class ErrorPageLoop extends AuthError {
191183
* @noInheritDoc
192184
*/
193185
export class EventError extends AuthError {
194-
/** @internal */
195186
static type = "EventError"
196187
}
197188

@@ -207,7 +198,6 @@ export class EventError extends AuthError {
207198
* @noInheritDoc
208199
*/
209200
export class InvalidCallbackUrl extends AuthError {
210-
/** @internal */
211201
static type = "InvalidCallbackUrl"
212202
}
213203

@@ -219,7 +209,6 @@ export class InvalidCallbackUrl extends AuthError {
219209
* @noInheritDoc
220210
*/
221211
export class CredentialsSignin extends SignInError {
222-
/** @internal */
223212
static type = "CredentialsSignin"
224213
/**
225214
* The error code that is set in the `code` query parameter of the redirect URL.
@@ -243,7 +232,6 @@ export class CredentialsSignin extends SignInError {
243232
* @noInheritDoc
244233
*/
245234
export class InvalidEndpoints extends AuthError {
246-
/** @internal */
247235
static type = "InvalidEndpoints"
248236
}
249237

@@ -255,7 +243,6 @@ export class InvalidEndpoints extends AuthError {
255243
* @noInheritDoc
256244
*/
257245
export class InvalidCheck extends AuthError {
258-
/** @internal */
259246
static type = "InvalidCheck"
260247
}
261248

@@ -272,7 +259,6 @@ export class InvalidCheck extends AuthError {
272259
* @noInheritDoc
273260
*/
274261
export class JWTSessionError extends AuthError {
275-
/** @internal */
276262
static type = "JWTSessionError"
277263
}
278264

@@ -285,7 +271,6 @@ export class JWTSessionError extends AuthError {
285271
* @noInheritDoc
286272
*/
287273
export class MissingAdapter extends AuthError {
288-
/** @internal */
289274
static type = "MissingAdapter"
290275
}
291276

@@ -298,7 +283,6 @@ export class MissingAdapter extends AuthError {
298283
* @noInheritDoc
299284
*/
300285
export class MissingAdapterMethods extends AuthError {
301-
/** @internal */
302286
static type = "MissingAdapterMethods"
303287
}
304288

@@ -310,7 +294,6 @@ export class MissingAdapterMethods extends AuthError {
310294
* @noInheritDoc
311295
*/
312296
export class MissingAuthorize extends AuthError {
313-
/** @internal */
314297
static type = "MissingAuthorize"
315298
}
316299

@@ -329,7 +312,6 @@ export class MissingAuthorize extends AuthError {
329312
* @noInheritDoc
330313
*/
331314
export class MissingSecret extends AuthError {
332-
/** @internal */
333315
static type = "MissingSecret"
334316
}
335317

@@ -347,7 +329,6 @@ export class MissingSecret extends AuthError {
347329
* @noInheritDoc
348330
*/
349331
export class OAuthAccountNotLinked extends SignInError {
350-
/** @internal */
351332
static type = "OAuthAccountNotLinked"
352333
}
353334

@@ -359,7 +340,6 @@ export class OAuthAccountNotLinked extends SignInError {
359340
* @noInheritDoc
360341
*/
361342
export class OAuthCallbackError extends SignInError {
362-
/** @internal */
363343
static type = "OAuthCallbackError"
364344
}
365345

@@ -370,7 +350,6 @@ export class OAuthCallbackError extends SignInError {
370350
* @noInheritDoc
371351
*/
372352
export class OAuthProfileParseError extends AuthError {
373-
/** @internal */
374353
static type = "OAuthProfileParseError"
375354
}
376355

@@ -383,7 +362,6 @@ export class OAuthProfileParseError extends AuthError {
383362
* @noInheritDoc
384363
*/
385364
export class SessionTokenError extends AuthError {
386-
/** @internal */
387365
static type = "SessionTokenError"
388366
}
389367

@@ -404,7 +382,6 @@ export class SessionTokenError extends AuthError {
404382
* @noInheritDoc
405383
*/
406384
export class OAuthSignInError extends SignInError {
407-
/** @internal */
408385
static type = "OAuthSignInError"
409386
}
410387

@@ -420,7 +397,6 @@ export class OAuthSignInError extends SignInError {
420397
* @noInheritDoc
421398
*/
422399
export class EmailSignInError extends SignInError {
423-
/** @internal */
424400
static type = "EmailSignInError"
425401
}
426402

@@ -435,7 +411,6 @@ export class EmailSignInError extends SignInError {
435411
* @noInheritDoc
436412
*/
437413
export class SignOutError extends AuthError {
438-
/** @internal */
439414
static type = "SignOutError"
440415
}
441416

@@ -446,7 +421,6 @@ export class SignOutError extends AuthError {
446421
* @noInheritDoc
447422
*/
448423
export class UnknownAction extends AuthError {
449-
/** @internal */
450424
static type = "UnknownAction"
451425
}
452426

@@ -457,7 +431,6 @@ export class UnknownAction extends AuthError {
457431
* @noInheritDoc
458432
*/
459433
export class UnsupportedStrategy extends AuthError {
460-
/** @internal */
461434
static type = "UnsupportedStrategy"
462435
}
463436

@@ -466,7 +439,6 @@ export class UnsupportedStrategy extends AuthError {
466439
* @noInheritDoc
467440
*/
468441
export class InvalidProvider extends AuthError {
469-
/** @internal */
470442
static type = "InvalidProvider"
471443
}
472444

@@ -483,7 +455,6 @@ export class InvalidProvider extends AuthError {
483455
* @noInheritDoc
484456
*/
485457
export class UntrustedHost extends AuthError {
486-
/** @internal */
487458
static type = "UntrustedHost"
488459
}
489460

@@ -494,7 +465,6 @@ export class UntrustedHost extends AuthError {
494465
* @noInheritDoc
495466
*/
496467
export class Verification extends AuthError {
497-
/** @internal */
498468
static type = "Verification"
499469
}
500470

@@ -510,7 +480,6 @@ export class Verification extends AuthError {
510480
* @noInheritDoc
511481
*/
512482
export class MissingCSRF extends SignInError {
513-
/** @internal */
514483
static type = "MissingCSRF"
515484
}
516485

@@ -541,7 +510,6 @@ export function isClientError(error: Error): error is AuthError {
541510
* @noInheritDoc
542511
*/
543512
export class DuplicateConditionalUI extends AuthError {
544-
/** @internal */
545513
static type = "DuplicateConditionalUI"
546514
}
547515

@@ -552,7 +520,6 @@ export class DuplicateConditionalUI extends AuthError {
552520
* @noInheritDoc
553521
*/
554522
export class MissingWebAuthnAutocomplete extends AuthError {
555-
/** @internal */
556523
static type = "MissingWebAuthnAutocomplete"
557524
}
558525

@@ -561,7 +528,6 @@ export class MissingWebAuthnAutocomplete extends AuthError {
561528
* @noInheritDoc
562529
*/
563530
export class WebAuthnVerificationError extends AuthError {
564-
/** @internal */
565531
static type = "WebAuthnVerificationError"
566532
}
567533

@@ -573,7 +539,6 @@ export class WebAuthnVerificationError extends AuthError {
573539
* @noInheritDoc
574540
*/
575541
export class AccountNotLinked extends SignInError {
576-
/** @internal */
577542
static type = "AccountNotLinked"
578543
}
579544

@@ -582,6 +547,5 @@ export class AccountNotLinked extends SignInError {
582547
* @noInheritDoc
583548
*/
584549
export class ExperimentalFeatureNotEnabled extends AuthError {
585-
/** @internal */
586550
static type = "ExperimentalFeatureNotEnabled"
587551
}

packages/core/src/providers/asgardeo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface AsgardeoProfile extends Record<string, any> {
4545
* #### Configuration
4646
*```ts
4747
* import { Auth } from "@auth/core"
48-
* import Asgarde from "@auth/core/providers/asgardeo";
48+
* import Asgardeo from "@auth/core/providers/asgardeo";
4949
*
5050
* const request = new Request(origin)
5151
* const response = await Auth(request, {

packages/frameworks-qwik/src/index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@
110110
*/
111111

112112
import type { AuthConfig } from "@auth/core"
113-
import { Auth, isAuthAction, skipCSRFCheck, customFetch } from "@auth/core"
113+
import {
114+
Auth,
115+
isAuthAction,
116+
skipCSRFCheck,
117+
customFetch as _customFetch,
118+
} from "@auth/core"
114119
import { AuthAction, Session } from "@auth/core/types"
115120
import { implicit$FirstArg, type QRL } from "@builder.io/qwik"
116121
import {
@@ -124,7 +129,8 @@ import { EnvGetter } from "@builder.io/qwik-city/middleware/request-handler"
124129
import { isServer } from "@builder.io/qwik/build"
125130
import { parseString, splitCookiesString } from "set-cookie-parser"
126131

127-
export { customFetch }
132+
export const customFetch = isServer ? _customFetch : undefined
133+
128134
export { AuthError, CredentialsSignin } from "@auth/core/errors"
129135

130136
export type {
@@ -149,6 +155,7 @@ export function QwikAuthQrl(
149155
{ providerId, redirectTo: _redirectTo, options, authorizationParams },
150156
req
151157
) => {
158+
if (!isServer) return
152159
const { redirectTo = _redirectTo ?? defaultRedirectTo(req), ...rest } =
153160
options ?? {}
154161

@@ -192,6 +199,7 @@ export function QwikAuthQrl(
192199

193200
const useSignOut = globalAction$(
194201
async ({ redirectTo }, req) => {
202+
if (!isServer) return
195203
redirectTo ??= defaultRedirectTo(req)
196204
const authOpts = await authOptions(req)
197205
setEnvDefaults(req.env, authOpts)
@@ -261,6 +269,7 @@ async function authAction(
261269
path: string,
262270
authOptions: QwikAuthConfig
263271
) {
272+
if (!isServer) return
264273
const request = new Request(new URL(path, req.request.url), {
265274
method: req.request.method,
266275
headers: req.request.headers,
@@ -337,6 +346,7 @@ async function getSessionData(
337346
}
338347

339348
export const setEnvDefaults = (env: EnvGetter, config: AuthConfig) => {
349+
if (!isServer) return
340350
config.basePath = "/auth"
341351
if (!config.secret?.length) {
342352
config.secret = []

0 commit comments

Comments
 (0)