-
Notifications
You must be signed in to change notification settings - Fork 216
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
Custom Domain with URL scheme (https://) causes token decoding to fail #630
Comments
Hey @barasimumatik 👋 Good catch, and thanks for the detailed explanation. This is indeed an oversight on my part and should be considered a bug. I'm on vacation this coming week but I'll get a bug fix release out once I return to address this. Thanks for the heads up! |
No problem, I'm just glad I could help in some way 😃 |
If anyone else has my problem regarding multiple issuers (in this case when it is either the Auth0 domain or the custom domain) this is what I do now:
|
This should be resolved as of 8.2.1! Please let me know how it goes for you. Thanks again for bringing this to our attention 👍 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
SDK Version
8.2
PHP Version
PHP 7.4
What happened?
Given this configuration
and calling
$this->auth0->decode($token);
results in an exception due to the custom domain being invalidHow can we reproduce this issue?
Additional context
This is a bit of a side note, but when we added custom domains to our tenants we implemented support in our API for validating tokens by allowing both the tenant domain and the custom domain as token issuers (to ease migration for dependant applications).
To do this we simply parsed the token and checked which one of the domains (if any) was part of the 'iss' claim (otherwise we rejected the token) before calling the SDK to verify and decode the token (SDK version 7.x). Not very nice, but it worked. Since then it stayed that way even after migrating (and frankly, it wouldn't surprise me if something would break if we switched to exclusively use the custom domains instead of the tenant domains).
We are now in the process of migrating to PHP8.1 and one of the first dependencies we need to migrate is the SDK. I noticed that the
SdkConfiguration
allows setting thedomain
andcustomDomain
individually, so I hoped the SDK would take care of checking that the issuer corresponds to one of them as part of verification/validation but it doesn't seem like it does (I would really appreciate a workaround if anyone has any suggestions).Looking at the values returned from the
SdkConfiguration
, it looks like it strips the URL scheme from thedomain
, but not thecustomDomain
, so the formatDomain/formatCustomDomain methods will get an extra "https://" tacked onto it.Then I don't really know what is going on with the JWKS URL, but I guess that is related to the above.
Now, I can just remove the "https://" from the custom domain, but shouldn't it the behaviour be consistent between domain and customDomain (i.e. it strips the URL scheme in both)?
The text was updated successfully, but these errors were encountered: