mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-08 16:34:55 +02:00
Add ENV REACT_CLIENT_PATH to target a Nextjs frontend instead of Nuxt
This commit is contained in:
parent
108b2a60f5
commit
a992400d6a
3 changed files with 57 additions and 31 deletions
|
@ -442,7 +442,17 @@ class Auth {
|
|||
// Local strategy login route (takes username and password)
|
||||
router.post('/login', passport.authenticate('local'), async (req, res) => {
|
||||
// return the user login response json if the login was successfull
|
||||
res.json(await this.getUserLoginResponsePayload(req.user))
|
||||
const userResponse = await this.getUserLoginResponsePayload(req.user)
|
||||
|
||||
// Experimental Next.js client uses bearer token in cookies
|
||||
res.cookie('auth_token', userResponse.user.token, {
|
||||
httpOnly: true,
|
||||
secure: req.secure || req.get('x-forwarded-proto') === 'https',
|
||||
sameSite: 'strict',
|
||||
maxAge: 1000 * 60 * 60 * 24 * 7 // 7 days
|
||||
})
|
||||
|
||||
res.json(userResponse)
|
||||
})
|
||||
|
||||
// openid strategy login route (this redirects to the configured openid login provider)
|
||||
|
@ -718,6 +728,7 @@ class Auth {
|
|||
const authMethod = req.cookies.auth_method
|
||||
|
||||
res.clearCookie('auth_method')
|
||||
res.clearCookie('auth_token')
|
||||
|
||||
let logoutUrl = null
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue