next-auth: Custom provider url undefined
Hi,
I’m using a custom provider and during the callback redirection to my website, I get this error that breaks npm:
internal/validators.js:117
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
I tried to search around and can’t seem to understand where it comes form as all the required parameters to build the provider were passed.
Am I missing something?
Thanks in advance
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 26 (13 by maintainers)
Thanks, the full error is very helpful.
I suspect there is something wrong with your provider config, but I am not sure what. I would console.log() the output of the provider at run time. That error is happening because one of the values is empty. We can probably add some error handling to help point out which option is missing.
Yes that’s right, that is as show on the documentation page and in the example project.
All that’s actually needed is:
But, as the tip in the documentation mentions below the example, you can add
session={session}(usingsessionfromsession.pageProps) as an optimisation.Hi @iaincollins,
First of all, thanks for the effort you put in the answer, is really appreciated. I’ve updated to the beta.71 and enabled the
getProfileFromToken: true. The result was an error that brakes execution in npm, below the output:The output of the
console.log(profile)isundefined.Regarding the provider, it’s an acquired solution from an Australian vendor based on .NET. The source-code is not available so I don’t know if they used a library or some kind of custom implementation.
I think the best is to abandon the idea of integrating this solution with next-auth and create a manual callback system that sets the token in a Cookie.
Let me know if you want to try something else to improve the library, but for me the issue can be closed.
I was changing the Auth0 config to simplify it (just added a PR) and when I had a typo in one of the required URLs I was having the same error as referred to in this issue. So I guess it’s probably just a wrong config? I’m not able to replicate it with custom providers unless there is a wrong URL.
Hmm this sounds like something is up with the Laravel Passport config, as I can see other people running into some of these errors using it with other libraries.
e.g.
JSON_INVALID_UTF8_SUBSTITUTEis a PHP error.I would ask the folks over at Laravel Passport if the config looks sane and for advice on common causes of that error.
I suspect the
ERR_INVALID_ARG_TYPEarg is being throw from within next-auth (by a function it invokes) but I think it might be happening because either one of the URLs specified is invalid or returns an invalid response.Hm okay, I thought it was OAuth missing some required options which were causing the error.
@nunorbatista try adding a
scope: ''option too even if it’s just an empty one. I’m not sure if that will fix it but I think that might work.@mavichow can you change
optionstoparamsand check if that works? I think that’s the culprit.I’m facing the same issue, I’m currently using Laravel Passport as my custom providers too and received below errors on the callback:
My oauth2 settings as bellow:
thanks!