Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/runtime/composables/authjs/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,19 @@ export function useAuth(): UseAuthReturn {
json: true
})

const fetchSignIn = () => _fetch<{ url: string }>(nuxt, `/${action}/${provider}`, {
method: 'post',
params: authorizationParams,
headers,
body
}).catch<Record<string, any>>((error: { data: any }) => error.data)
const fetchSignIn = () => _fetch<{ url: string }>(
nuxt,
`/${action}/${provider}`,
{
method: 'post',
params: authorizationParams,
headers,
body
},
/* proxyCookies = */ true
)
.catch<Record<string, any>>((error: { data: any }) => error.data)

const data = await callWithNuxt(nuxt, fetchSignIn)

if (redirect || !isSupportingReturn) {
Expand Down Expand Up @@ -272,7 +279,7 @@ export function useAuth(): UseAuthReturn {
onRequestError: onError,
onResponseError: onError,
headers
})
}, /* proxyCookies = */ true)
}
function getSessionWithNuxt(nuxt: NuxtApp) {
return callWithNuxt(nuxt, getSession)
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/composables/local/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function useAuth(): UseAuthReturn {
body: credentials,
params: signInParams ?? {},
headers: signInHeaders ?? {}
})
}, /* proxyCookies = */ true)

if (typeof response !== 'object' || response === null) {
console.error(`${ERROR_PREFIX} signIn returned non-object value`)
Expand Down Expand Up @@ -187,7 +187,7 @@ export function useAuth(): UseAuthReturn {

loading.value = true
try {
const result = await _fetch<any>(nuxt, path, { method, headers }, true)
const result = await _fetch<any>(nuxt, path, { method, headers }, /* proxyCookies = */ true)
const { dataResponsePointer: sessionDataResponsePointer } = config.session
data.value = jsonPointerGet<SessionData>(result, sessionDataResponsePointer)
}
Expand Down
Loading