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

Google Sign-On with new libraries #5777

Merged
merged 3 commits into from
Oct 12, 2022

Conversation

Saparbek-Nagashibekov
Copy link
Contributor

Fixes #5776

Short description of what this resolves:

OpenEMR Google Sign-On with new libraries

Changes proposed in this pull request:

Added Google new library changes

const auth_response = googleUser.getAuthResponse();
const id_token = auth_response.id_token;

// const auth_response = googleUser.getAuthResponse();
Copy link
Member

Choose a reason for hiding this comment

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

ok to remove this instead of commenting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stephenwaite I made changes like you said. Could you review
commit cd882f8 ?
What is the next step?
Thanks

@stephenwaite
Copy link
Member

hi @Saparbek-Nagashibekov , left some things to fix up on a quick review, haven't tested this though

<!DOCTYPE html>
<html lang="en">
<head>
{% if displayGoogleSignin %}
<meta name="google-signin-client_id" content="{{ googleSigninClientID|attr }}">
{% endif %}
<script src="https://accounts.google.com/gsi/client" async defer></script>
<div id="g_id_onload"
data-client_id="{{ googleSigninClientID }}"
Copy link
Member

Choose a reason for hiding this comment

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

need to html escape this via attr:

data-client_id="{{ googleSigninClientID|attr }}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, how to do that ? could you give your suggested change? I will add it. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@bradymiller bradymiller Sep 24, 2022

Choose a reason for hiding this comment

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

i should of been more clear. you pipe it through the attr to html escape it there (see line below):

data-client_id="{{ googleSigninClientID|attr }}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What does it mean "html escape this via attr" how can I do that? Could you give me sample. thanks

Copy link
Member

@bradymiller bradymiller Sep 24, 2022

Choose a reason for hiding this comment

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

here is what the line should look like (see where the |attr is in below line :) ):

data-client_id="{{ googleSigninClientID|attr }}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Brady,
made changes. please check commit 1d831fc
Thanks

<div id="g_id_onload"
data-client_id="{{ googleSigninClientID }}"
data-callback="onSignInSuccess" data-auto_prompt="false">
</div>
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this block of code be within the above if conditional in line 4?
(ie. only shows if displayGoogleSignin)

@@ -1,10 +1,15 @@
{% set srOnly = (showLabels == true) ? "" : "sr-only" %}
Copy link
Member

Choose a reason for hiding this comment

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

above line looks like an unrelated change. If so, would add it back.

@bradymiller
Copy link
Member

bradymiller commented Sep 23, 2022

hi @Saparbek-Nagashibekov , thanks for addressing this bug! Just noted a couple issues.
Quick question:
It looks like this new library is required for new users (per the forum). Will these changes be backward compatible for users that were using the old library?

@bradymiller
Copy link
Member

hi @Saparbek-Nagashibekov , Code looks good. Just let me know this is testing well for you and then will bring it in. thanks!

@stephenwaite
Copy link
Member

stephenwaite commented Oct 9, 2022

this is testing well

I think a separate issue is that the login process is not checking the Google Email for Login field in Edit User, google_signin_email, against the google email used in the oauth flow

edit: or maybe am misunderstanding the flow since it should work without filling in the Username and Password fields, or maybe I haven't set this up correctly on my testing instance

2nd edit: it's MFA that interrupts the flow so MFA cannot be activated for google sign in

@sjpadgett
Copy link
Member

@kchapple or @growlingflea
Can one of you guys help us ensure we are fixing this correctly so we can get in next patch. Thanks.

@stephenwaite
Copy link
Member

ran another test with another email and it successfully finds the user with the google email and signs in without having to enter username/password

@bradymiller
Copy link
Member

Code looks good. Audited code on the server side of things and basically impossible to login unless authenticated (the passed token is confirmed with the stored client_id and google sign in email on the server end), so if the login is working on testing then this is good to bring in. Will bring this in and also bring into rel-700 branch. thanks @Saparbek-Nagashibekov !

@bradymiller bradymiller merged commit 2c45cd7 into openemr:master Oct 12, 2022
bradymiller pushed a commit that referenced this pull request Oct 12, 2022
@bradymiller
Copy link
Member

also, thanks @stephenwaite for testing!

2DV

@stephenwaite
Copy link
Member

southpark_cheering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenEMR Google Sign-On does not work
4 participants