-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Added Option to Use URLs Exactly As Specified #97
base: master
Are you sure you want to change the base?
Conversation
Oh also, I added the typings file for Typescript support. I took this directly from @Typings/passport-oauth2 |
Any chance this merge happening soon? I'm having a similar issue, but URL is not even a relative URL but a simple string value which resolves to an URL value on the provider side, but I believe this PR will help. |
Feel free to use my fork with the changes until this gets merged: https://github.com/mdemoret/passport-oauth2 You can add this to your packages with If/when it gets merged, it should be very simple to switch back. |
Hi again... So I have this https://github.com/roboli/passport-ebay ... Hopefully this PR will be merge soon. |
@mdemoret if you make a PR against https://github.com/passport-next/passport-oauth2 is will get looked into. |
@rwky Its been a while since I worked on my Oauth stuff so forgive my ignorance, but how is passport-next different than its predecessors? Would love to get this merged since using a github repo doesnt always work well in npm. |
@mdemoret Passport next is managed by an organisation so if one maintainer goes away it will still be maintained and other devs can be added unlike this library which has a sole maintainer and no one else can release to npm. You can install passport next via |
@rwky Great. I'll make a pull request soon. Shouldn't take long. The changes were minor. |
I added in a simple option
useExactURLs
that prevents the following code from being executed if thecallbackURL
is missing the HTTP protocol:This was needed due to an issue I encountered trying to use JupyterHub (https://github.com/jupyterhub/jupyterhub) as an OAuth2 provider. JupyterHub is expecting the
callbackURL
to be a relative path. If it is anything different (for example,http://localhost:8000/my_service/oauth_callback
vs/my_service/oauth_callback
) the process fails and the callback is never called.The only way to fix this (that I could think of) was to force passport-oauth2 to keep the URLs exactly as they are typed, or to change JupyterHub's authentication to accept more URLs. I can only assume that the JupyterHub team assumed that since every service (necessary to get the
client_id
) runs as a child process, that they will all be on the same hostname and relatives paths would be all that's necessary.I chose to add the
useExactURLs
option since its a much smaller fix and its possible someone else might could benefit from the additional option in the future. If you can think of something better for the option name thanuseExactURLs
please let me know. I struggled to come up with something concise that would also have a default value of false.FYI, I will be submitting an issue to the JupyterHub team as well. Hopefully, they can remedy this issue in one of their future releases.