1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-22 17:29:07 +00:00

Revert "fix auth error response and use 401 for malformed header"

This reverts commit 6dc4d10c25db7710b3e4e8e876d425a1e84574c8.

GitOrigin-RevId: 5d25af9026159b0c1e0a53f0d1fd0d9c685b40ee
This commit is contained in:
Ersun Warncke 2019-05-13 11:35:48 -04:00 committed by sharelatex
parent 89ee728514
commit 6d4b67d1ee

View file

@ -194,12 +194,10 @@ module.exports = AuthenticationController =
response = new Oauth2Server.Response(res)
Oauth2Server.server.authenticate request, response, {}, (err, token) ->
if err?
# use a 401 status code for malformed header for git-bridge
err.code = 401 if err.code == 400 and err.message == 'Invalid request: malformed authorization header'
# fall back to v1 on invalid token
return AuthenticationController._requireOauthV1Fallback req, res, next if err.code == 401
# send all other errors
return res.status(err.code).json({error: err.name, error_description: err.message})
# bubble up all other errors
return next(err)
req.oauth =
access_token: token.accessToken
req.oauth_token = token