fix: improve error message for invalid issuer URL in OAuth/OIDC flow …#13338
Open
Eahtasham wants to merge 1 commit intonextauthjs:mainfrom
Open
fix: improve error message for invalid issuer URL in OAuth/OIDC flow …#13338Eahtasham wants to merge 1 commit intonextauthjs:mainfrom
Eahtasham wants to merge 1 commit intonextauthjs:mainfrom
Conversation
…- Add try-catch block around URL constructor for issuer - Include the invalid URL value in error message - Provide helpful context about expected URL format - Makes debugging OAuth/OIDC configuration issues easier Before: 'Invalid URL' After: 'Invalid issuer URL: "invalid-url". The issuer must be a valid URL.' Fixes Issue number nextauthjs#13234
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
@Eahtasham is attempting to deploy a commit to the authjs Team on Vercel. A member of the Team first needs to authorize it. |
Broken Link Checker
1) /getting-started/migrate-to-better-auth
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…- Add try-catch block around URL constructor for issuer - Include the invalid URL value in error message - Provide helpful context about expected URL format - Makes debugging OAuth/OIDC configuration issues easier Before: 'Invalid URL' After: 'Invalid issuer URL: "invalid-url". The issuer must be a valid URL.' Fixes Issue number #13234
☕️ Reasoning
When an invalid URL is provided in the
issuerconfiguration during OAuth/OIDC authentication setup, the error message only displays "Invalid URL" without showing which URL value was problematic. This makes debugging configuration issues unnecessarily difficult for developers.This PR improves the error message by:
new URL(provider.issuer!)constructorBefore:
After:
Testing:
Tested locally using the dev app (
pnpm dev) with various invalid URL formats:"invalid-url-test"- missing protocol scheme"not-a-valid-url"- completely invalid format"https://signin/redirectTo=home"- malformed URLAll test cases now clearly display the problematic URL value in the error message, making it immediately obvious what needs to be fixed in the configuration.
This makes it immediately clear what configuration value needs to be fixed, significantly improving the developer experience.
🧢 Checklist
"invalid-url-test""not-a-valid-url""https://signin/redirectTo=home"🎫 Affected issues
Fixes: #13234
📌 Resources