You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* We cannot directly call and/or return `signIn` here as `signIn` uses async composables under the hood, leading to "nuxt instance undefined errors", see https://github.com/nuxt/framework/issues/5740#issuecomment-1229197529
198
198
*
199
199
* So to avoid calling it, we return it immediately.
200
+
*
201
+
* Important: you need to explicitly handle the value returned by the `signIn`,
202
+
* for example by changing it to `false` (to abort further navigation) or `undefined` (to process other middleware).
203
+
* See https://github.com/sidebase/nuxt-auth/issues/1042
* manually set `window.location.href` on the client **and then fake return a Promise that does not immediately resolve to block navigation (although it will not actually be fully awaited, but just be awaited long enough for the naviation to complete)**.
17
17
* 2. Additionally on the server-side, we cannot use `navigateTo(signInUrl)` as this uses `vue-router` internally which does not know the "external" sign-in page of next-auth and thus will log a warning which we want to avoid.
18
18
*
19
-
* Adapted from https://github.com/nuxt/nuxt/blob/16d213bbdcc69c0cc72afb355755ff877654a374/packages/nuxt/src/app/composables/router.ts#L119-L217
19
+
* Adapted from https://github.com/nuxt/nuxt/blob/dc69e26c5b9adebab3bf4e39417288718b8ddf07/packages/nuxt/src/app/composables/router.ts#L130-L247
// We wait to perform the redirect last in case any other middleware will intercept the redirect
59
+
// and redirect somewhere else instead.
60
+
if(!isExternalHost&&inMiddleware){
61
+
// For an unknown reason, `final.fullPath` received here is not percent-encoded, leading to the check always failing.
62
+
// To preserve compatibility with NuxtAuth < 1.0, we simply return `undefined`.
63
+
// TODO: Find the reason or report the issue to Nuxt if `navigateTo` has the same problem (`router.resolve` handles the `%2F` in callback URL correctly)
0 commit comments