Skip to content

Commit

Permalink
More cookie debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jun 27, 2024
1 parent e3f3aff commit 31c0e9e
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ export class DbAuthHandler<
get _deleteSessionHeader(): Headers {
const deleteHeaders = new Headers()

console.log('')
console.log('------')
console.log('')
console.trace()
console.log('')
console.log('------')
console.log(
Expand Down Expand Up @@ -431,6 +435,12 @@ export class DbAuthHandler<
),
)

console.log('')
console.log('------')
console.log('deleteHeaders', deleteHeaders)
console.log('------')
console.log('')

return deleteHeaders
}

Expand Down Expand Up @@ -632,21 +642,74 @@ export class DbAuthHandler<
}

async getToken(): Promise<AuthMethodOutput> {
console.log('')
console.log('------')
console.log('')
console.log('getToken')
console.log('')
console.log('getToken cookie', this.cookie)
console.log('')
console.log('------')
console.log('')

try {
const user = await this._getCurrentUser()
console.log('')
console.log('------')
console.log('')
console.log('getToken user', user)
console.log('')
console.log('------')
console.log('')
let headers = new Headers()

// if the session was encrypted with the old algorithm, re-encrypt it
// with the new one
if (isLegacySession(this.cookie)) {
console.log('')
console.log('------')
console.log('')
console.log('getToken isLegacySession')
console.log('')
console.log('------')
console.log('')
headers = this._loginResponse(user)[1]
}

console.log('')
console.log('------')
console.log('')
console.log('getToken headers', headers)
console.log('')
console.log('------')
console.log('')

return [user[this.options.authFields.id], headers]
} catch (e: any) {
console.log('')
console.log('------')
console.log('')
console.log('getToken catch e', e)
console.log('')
console.log('------')
console.log('')
if (e instanceof DbAuthError.NotLoggedInError) {
console.log('')
console.log('------')
console.log('')
console.log('getToken catch NotLoggedInError')
console.log('')
console.log('------')
console.log('')
return this._logoutResponse()
} else {
console.log('')
console.log('------')
console.log('')
console.log('getToken catch !NotLoggedInError', e.message)
console.log('')
console.log('------')
console.log('')
return this._logoutResponse({ error: e.message })
}
}
Expand Down

0 comments on commit 31c0e9e

Please sign in to comment.