Skip to content

Instantly share code, notes, and snippets.

@patrikengborg
Last active February 5, 2020 12:58
Show Gist options
  • Save patrikengborg/5a2a615ce6222ad255d0a1762bcaa52a to your computer and use it in GitHub Desktop.
Save patrikengborg/5a2a615ce6222ad255d0a1762bcaa52a to your computer and use it in GitHub Desktop.
async login({ response, auth, request }) {
const { email, password } = request.all()
const data = await auth.attempt(email, password)
if (data.token) {
return response.cookie('token', data.token, {
domain: 'mydomain.com',
httpOnly: true,
secure: true,
sameSite: 'Lax',
path: '/'
})
}
return data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment