This commit is contained in:
+4
-4
@@ -54,9 +54,9 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
|
||||
const ip = observedClientIP(request?.headers ?? new Headers())
|
||||
if (ip && secret) {
|
||||
const { ts, sig } = signClientIP(secret, ip)
|
||||
headers['x-computer-client-ip'] = ip
|
||||
headers['x-computer-client-ts'] = ts
|
||||
headers['x-computer-client-sig'] = sig
|
||||
headers['x-superbrain-client-ip'] = ip
|
||||
headers['x-superbrain-client-ts'] = ts
|
||||
headers['x-superbrain-client-sig'] = sig
|
||||
}
|
||||
const response = await fetch(`${process.env.API_BASE_URL || 'http://localhost:8080'}/api/auth/login`, {
|
||||
method: 'POST', headers, cache: 'no-store',
|
||||
@@ -124,7 +124,7 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
// Same short-lived assertion the data proxy signs (lib/api.ts).
|
||||
Authorization: `Bearer ${jwt.sign({ uid: id, ver, typ: 'assertion' }, secret, { algorithm: 'HS256', issuer: 'computer', expiresIn: '60s' })}`,
|
||||
Authorization: `Bearer ${jwt.sign({ uid: id, ver, typ: 'assertion' }, secret, { algorithm: 'HS256', issuer: 'superbrain', expiresIn: '60s' })}`,
|
||||
},
|
||||
cache: 'no-store',
|
||||
signal: controller.signal,
|
||||
|
||||
Reference in New Issue
Block a user