Describe the bug
302 redirects are not followed for the profileUrl when authenticating with OAuth 2. The root cause is due to the underlying library used for authentication, oauth. However, this library is unmaintained and has had an open issue for it for 6+ years: ciaranj/node-oauth#201.
This issue causes profileData to be an empty string. Then in getProfile, an error is raised due to JSON.parse.
Steps to reproduce
I'm creating a custom provider where the profileUrl returns a redirect to the actual url. In this instance, /api/users/current redirects to /api/users/{current_user_id}.
Expected behavior
The Location header is followed for 302 redirects. Alternatively, the library includes a way for developers to follow the redirects themselves.
Additional context
If help is needed, I can open a PR for this. I think the callback to _request here can take in the response and issue another request if it's a response with a Location header and 3xx status code.
Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
Describe the bug
302 redirects are not followed for the
profileUrlwhen authenticating with OAuth 2. The root cause is due to the underlying library used for authentication, oauth. However, this library is unmaintained and has had an open issue for it for 6+ years: ciaranj/node-oauth#201.This issue causes
profileDatato be an empty string. Then in getProfile, an error is raised due toJSON.parse.Steps to reproduce
I'm creating a custom provider where the
profileUrlreturns a redirect to the actual url. In this instance,/api/users/currentredirects to/api/users/{current_user_id}.Expected behavior
The
Locationheader is followed for302redirects. Alternatively, the library includes a way for developers to follow the redirects themselves.Additional context
If help is needed, I can open a PR for this. I think the callback to
_requesthere can take in theresponseand issue another request if it's a response with aLocationheader and3xxstatus code.Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.