Skip to content

Instantly share code, notes, and snippets.

@acfatah
Created September 25, 2019 01:25
Show Gist options
  • Save acfatah/b7387e72f8cc48e1993e31534bcc9479 to your computer and use it in GitHub Desktop.
Save acfatah/b7387e72f8cc48e1993e31534bcc9479 to your computer and use it in GitHub Desktop.
Authorization Bearer Token Parser Function For Express
export default request => {
let parts = request.headers.authorization.split(' ')
if (request.headers.authorization && parts[0] === 'Bearer') {
return parts[1]
} else if (request.query && request.query.token) {
return request.query.token
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment