Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

👽️ Migrate to Google Identity Services (#227) #233

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

mistryrn
Copy link

  • Config changes to fix compatibility with Apple Silicon Macs
  • Dependency upgrades and version pinning to fix build and runtime errors
  • Switch to @react-oauth/google for Google Login

* Replace `node-sass` (incompatible with Apple Silicon architecture) with `sass`
* Replace existing Google log in button with new react-oauth/google sign-in button
* TODO: update API/backend
* TODO: implement Google logout
* Pins `psycopg2` to v2.8.6 to prevent `AssertionError: database connection isn't set to UTC` error which was causing `500` server errors on higher versions of the library with Django
* Force Node 16 in UI Dockerfile to avoid compatibility issues with Node 18
* Use new `@react-oauth/google` library for Google Sign-in
* Create `GoogleLoginButton` component to mimic the previous Login button style
@@ -22,7 +22,7 @@ mccabe==0.6.1
oauthlib==2.0.6
openapi-codec==1.3.2
pip-autoremove==0.9.0
psycopg2>=2.8
psycopg2==2.8.6
Copy link
Author

Choose a reason for hiding this comment

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

@@ -1,6 +1,6 @@
# Copyright 2020(c) The Ontario Institute for Cancer Research. All rights reserved.

FROM node AS prebuilder
FROM node:16 AS prebuilder
Copy link
Author

Choose a reason for hiding this comment

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

Prevents Docker from using Node 18+, as that breaks compatibility with this project. Node 16 appears to be the latest version of Node that will play nice with this.

</Main>
</Switch>
</App>
<GoogleOAuthProvider clientId={clientId}>
Copy link
Author

Choose a reason for hiding this comment

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

Looks like a lot, but I'm just wrapping the App in the GoogleOAuthProvider here. Necessary for the new Google auth library.

@@ -0,0 +1,73 @@
// adapted from: https://github.com/anthonyjgrove/react-google-login/blob/master/src/google-login.js
Copy link
Author

Choose a reason for hiding this comment

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

In order to get the access_token required by our back-end, we have to use this library's "custom" button (the default, styled-out-of-the-box Login button does not return this token) which has no styles.

Rather than reinventing the wheel, I just adapted the button component the previous library was using. No one will suspect a thing ;)

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

Successfully merging this pull request may close these issues.

1 participant