Skip to content
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

fix: Google authorization fix in dev-demo #1437

Closed
wants to merge 8 commits into from
Closed

fix: Google authorization fix in dev-demo #1437

wants to merge 8 commits into from

Conversation

Intevel
Copy link
Contributor

@Intevel Intevel commented Jan 14, 2022

This PR belongs to this Issue #1435

@Intevel
Copy link
Contributor Author

Intevel commented Jan 14, 2022

@bmulholland This is the fix for google auth in demo-app, related to #1393

@Intevel Intevel changed the title fix(google auth): Google authorization fix in dev-demo fix: Google authorization fix in dev-demo Jan 14, 2022
I have added Spotify auth with the oauth2 scheme. Also added it directly to the demo, and tested everything.
Added the spotify oauth provider to the docs and changed positions
@Intevel Intevel changed the title fix: Google authorization fix in dev-demo fix: Google authorization fix in dev-demo feat: spotify oauth2 provider Jan 14, 2022
@Intevel
Copy link
Contributor Author

Intevel commented Jan 14, 2022

I added the Spotify auth provider to this in the oauth2 schema, he put that in this PR for whatever reason.

@Intevel Intevel changed the title fix: Google authorization fix in dev-demo feat: spotify oauth2 provider fix: Google authorization fix in dev-demo & feat: spotify oauth2 provider Jan 14, 2022
@bmulholland
Copy link
Contributor

Please separate spotify into a separate PR -- having two things together makes it hard for me to review. You'll need to create a separate branch & PR; anything on your dev branch is going to update this PR here.

@@ -12,6 +12,7 @@ export function google(
): void {
const DEFAULTS: typeof strategy = {
scheme: 'oauth2',
codeChallengeMethod: '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it doesn't work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S256 doesn't work properly in the context, why I don't know. There is a lot on stsckoverflow about this and the only way to solve this is to leave it empty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked the app I work on, and we have Google's S256 deployed in production. So it does work, and since Google recommends it, I think S256 should be the default for the google provider.

If you can't get the demo site working with S256 right now, you could turn off code challenge specifically in the demo/nuxt.config. Please try to get "plain" working instead. Ideally the demo config would only turn off code challenge when run locally, so that the code challenge method is still testable on the deployed demo site.

Then we can merge this in, but it's still not ideal: we should get S256 working and testable locally. This may need a secret key set, and maybe that's why you couldn't get it working? In any case, fixing S256 can be filed as a followup issue (please create that on Github) once this change is merged in.

@bmulholland
Copy link
Contributor

And thanks again for the help -- really appreciated!

@bmulholland
Copy link
Contributor

bmulholland commented Jan 19, 2022

Thanks for separating Spotify into a separate PR. Could you please also cut this one down to just the Google auth fix? Then I can review only those changes.

@Intevel Intevel changed the title fix: Google authorization fix in dev-demo & feat: spotify oauth2 provider fix: Google authorization fix in dev-demo Jan 19, 2022
@Intevel
Copy link
Contributor Author

Intevel commented Jan 19, 2022

I moved spotify to #1483

@bmulholland
Copy link
Contributor

Thank you!

@@ -10,3 +10,4 @@ dist
package-lock.json
_book
temp
demo/.env
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please fix the newline ending for this file?

@@ -259,7 +259,7 @@ export class Oauth2Scheme<
// Set Nonce Value if response_type contains id_token to mitigate Replay Attacks
// More Info: https://openid.net/specs/openid-connect-core-1_0.html#NonceNotes
// More Info: https://tools.ietf.org/html/draft-ietf-oauth-v2-threatmodel-06#section-4.6.2
if (opts.response_type.includes('token')) {
if (opts.response_type.includes('id_token')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about this change? How do we know it won't break anyone else's setup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't be 100% sure of course, I have seen some issues describing PR #709 was broken, after changing to id_token it worked for me. On Stackoverflow was also something about it, and in Issue #970 as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about lowering the risk by checking for either value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a look at it later, I'll try to fix the checks of PR #1483 first. 😂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good -- let me know if you get stuck. Thanks again for all your help!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've split this out into its own PR: #1532

@Intevel Intevel marked this pull request as draft January 25, 2022 06:57
@Intevel Intevel closed this Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants