-
-
Notifications
You must be signed in to change notification settings - Fork 753
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
chore(dependencies)!: update grant from 4.x to 5.x #1989
Conversation
@@ -40,12 +48,4 @@ describe('@feathersjs/authentication-oauth/express', () => { | |||
delete app.get('authentication').oauth.redirect; | |||
} | |||
}); | |||
|
|||
it('oauth/test/authenticate with error', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what to do with that test. The thrown error was only implemented in the mocked getProfile
function. Not sure what that was supposed to test in the first place.
Since getProfile
doesn't exist anymore, I just removed the test for now.
}); | ||
|
||
authApp.get('/:name/callback', (req: any, res: any) => { | ||
res.redirect(`${path}/connect/${req.params.name}/callback?${qs.stringify(req.query)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new grant version mounts at /prefix
instead of /prefix/connect
- so redirecting is not needed anymore, but the request can just be passed on to the next handler.
prefix, | ||
origin: `${protocol}://${host}`, | ||
transport: 'session', | ||
response: ['tokens', 'raw', 'profile'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
['tokens', 'raw']
should be the default - not sure whether tokens
would be enough?
profile
is added, to make grant make the request to profile_url
.
@@ -1,5 +1,4 @@ | |||
// @ts-ignore | |||
import getProfile from 'grant-profile/lib/client'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grant-profile
is now merged into grant
itself.
Thank you for the pull request, this is great! Since these are definitely breaking changes, could you do me a favour and resubmit it against the v5 branch at https://github.com/feathersjs/feathers/tree/dove? To test the changes in an application, in the Feathers repository you can do
Then in your project
The same steps work for any other modules that changed. As for getting the profile, I think the One way to improve the tests would be to create a test oAuth application, get an access token via an HTTP request and run the test with that. It wouldn't test the browser flow though of course. |
So I rebased on dove, force-pushed and changed the base branch for this PR - I guess that should do it in that regard? Keeping
Can you elaborate? Whats "this change" here - the whole update of grant or just the "removing getProfile" part? Thanks for the hint about |
Hi @daffl , any idea when this pull request might be available? I have a desperate need behind our corporate ntlm proxy. All web access is proxied so I can't get any of the OAuth grant to work unless I am outside our proxy server. The current 4.x branch works fine as long as I am not behind a proxy. Otherwise, It simply times out. I've tried the monkey patch suggestion by the author simov/grant#93 , but I can't get it to work either. Any help would be greatly appreciated. |
Because of the breaking changes this pull request requires a major release of which upgrading Grant is only a minor part. There is no release date for v5 other than before the end of the year and there is a lot that still needs to be done. You are welcome to book an office hour to see if there are ways to get things working for you before. |
So I brought back
Will look into this. |
The build is failing - but I have no idea how that error might be related to my changes. I don't know TypeScript well, though. |
Thank you again @wolfgangwalther, sorry it took so long! I got the build fixed and it is now merged with the |
BREAKING CHANGES: Updates Grant to the latest major version (see https://github.com/simov/grant/blob/master/MIGRATION.md)
BREAKING CHANGES: Updates Grant to the latest major version (see https://github.com/simov/grant/blob/master/MIGRATION.md)
This updates
@feathersjs/authentication-oauth
to use the new version of grant (5.x). (#1961)Among other stuff, the new grant version offers the possibility to pass options to the underlying http client, which is used for the request for
profile_url
. In my project I need to add proxy settings to this request.This should go together with a corresponding PR for the docs, as some things have changed with grant. This still needs to be done.
Unfortunately I was not able to test those changes in a real project. I tried installing the
@feathersjs/authentication-oauth
package from my own git repo instead of npm, but this didn't work out well, because of the monorepo structure.Because the unit tests don't implement a full oauth flow, I guess this should still be tested somehow. Especially the "getting the profile" part, because that was not tested but mocked before already and has completely changed now.
Any ideas on that, how to proceed here?