Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): add error code to SignInResponse #10943

Merged
merged 3 commits into from
Jun 2, 2024

Conversation

kaioduarte
Copy link
Contributor

☕️ Reasoning

Makes code property from custom error available on the client side. See:

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

📌 Resources

Copy link

vercel bot commented May 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2024 4:39am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Jun 2, 2024 4:39am
proxy ⬜️ Ignored (Inspect) Visit Preview Jun 2, 2024 4:39am

Copy link

vercel bot commented May 16, 2024

@kaioduarte is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@jhoanborges
Copy link

+1

@mrevanzak
Copy link

+1 need this too

@kaioduarte
Copy link
Contributor Author

@ndom91 @ThangHuuVu can we have your review on this one?

@ndom91 ndom91 changed the title add error code to SignInResponse fix(core): add error code to SignInResponse Jun 1, 2024
Copy link

codecov bot commented Jun 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 40.76%. Comparing base (656f1ec) to head (63e66ed).

Files Patch % Lines
packages/next-auth/src/react.tsx 0.00% 2 Missing ⚠️
packages/next-auth/src/webauthn.ts 0.00% 2 Missing ⚠️
packages/next-auth/src/lib/client.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10943      +/-   ##
==========================================
- Coverage   40.77%   40.76%   -0.01%     
==========================================
  Files         177      177              
  Lines       28022    28027       +5     
  Branches     1238     1244       +6     
==========================================
  Hits        11426    11426              
- Misses      16596    16601       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ThangHuuVu
Copy link
Member

thanks @kaioduarte , merging this & release 🔜

@ThangHuuVu ThangHuuVu merged commit 48f10f5 into nextauthjs:main Jun 2, 2024
12 of 15 checks passed
@kaioduarte kaioduarte deleted the fix/add-error-code branch June 2, 2024 07:46
@dml0031
Copy link

dml0031 commented Jun 2, 2024

Another update in the beta 19 may be conflicting with this change. After updating to 5.0.0-beta.19 the only error that gets returned from the authorize method is error?error=Configuration

Tested this by using the exact same code in beta 18 and then beta 19, on 18 it will return CredentialsSignIn as error type and the return url from the credentials endpoint contains both error and code params and the code param just doesnt get parsed by the next-auth/react package and returned to the client.

In 19, the return url from credentials endpoint doesnt contain the code param and the only thing it has is ?error=Configuration but the object returned from the signIn method does contain the code, its just always null no matter what error gets thrown in authorize

Edit: More Clarification

Example error:
Screenshot 2024-06-02 at 12 05 41 PM

Beta 18 Return URL: http://localhost:3000/login?error=CredentialsSignin&code=custom
Beta 19 Return URL: http://localhost:3000/login?error=Configuration

@guimmarques
Copy link

Another update in the beta 19 may be conflicting with this change. After updating to 5.0.0-beta.19 the only error that gets returned from the authorize method is error?error=Configuration

Tested this by using the exact same code in beta 18 and then beta 19, on 18 it will return CredentialsSignIn as error type and the return url from the credentials endpoint contains both error and code params and the code param just doesnt get parsed by the next-auth/react package and returned to the client.

In 19, the return url from credentials endpoint doesnt contain the code param and the only thing it has is ?error=Configuration but the object returned from the signIn method does contain the code, its just always null no matter what error gets thrown in authorize

Edit: More Clarification

Example error: Screenshot 2024-06-02 at 12 05 41 PM

Beta 18 Return URL: http://localhost:3000/login?error=CredentialsSignin&code=custom Beta 19 Return URL: http://localhost:3000/login?error=Configuration

same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants