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

Replace deprecated gapi.auth2 with GIS #2762

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Conversation

sumomomomomo
Copy link

@sumomomomomo sumomomomomo commented Feb 5, 2024

Description

Replaces calls to the deprecated gapi.auth2 with calls to Google Identity Services. With gapi.auth2, only api keys generated before 2022 July are functional (https://developers.google.com/identity/sign-in/web/sign-in). This change will also allow for local testing of Google persistence with user generated api keys.

All other calls made to gapi.client were untouched - GIS is used only to facilitate getting the access token from Google. google-oauth-gsi library is used for this. Existing Google picker UI remains the same.

Google login persistence is implemented by storing the access token in local storage.

Finally, login button is added to the Google Drive control bar for parity with Github control bar UI.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

Instructions from the wiki, "Obtaining the API keys from the Google API Console" is sufficient for setting up locally for testing.

Checklist

  • I have tested this code

@coveralls
Copy link

coveralls commented Feb 5, 2024

Pull Request Test Coverage Report for Build 8936442491

Details

  • 17 of 55 (30.91%) changed or added relevant lines in 6 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.07%) to 33.234%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/commons/application/actions/SessionActions.ts 4 5 80.0%
src/pages/playground/Playground.tsx 0 1 0.0%
src/commons/application/reducers/SessionsReducer.ts 0 3 0.0%
src/commons/sagas/PersistenceSaga.tsx 7 40 17.5%
Files with Coverage Reduction New Missed Lines %
src/commons/sagas/PersistenceSaga.tsx 3 44.44%
Totals Coverage Status
Change from base Build 8936341133: -0.07%
Covered Lines: 5319
Relevant Lines: 14878

💛 - Coveralls

@sayomaki
Copy link
Contributor

sayomaki commented Feb 5, 2024

Hi @sumomomomomo, congratulations on creating your first PR in Source Academy and to start contributing your changes! Do note that even though you bypassed the code validation and checking when pushing to the repository sub-branch, you should still ensure that your code is well formatted and passes tests before opening the pull request.

The points mentioned above can be done with the 2 commands as follows:

  • Testing: yarn test. If updating snapshots are required, you may run yarn test --updateSnapshot
  • Formatting: yarn format

I will take a look at your changes in a bit, and let you know some feedback for the changes that you have made. Keep up the good work and thanks for the contribution!

Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

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

Hi, thanks for working on this; there seems to be a couple of weird changes that I'm not sure about. I don't think there's a need to add any dependency, at least at the moment.

Though I really feel you should try to see if Google provides an NPM library to make it easier to interact with the API; if possible, we should not need to worry about writing our own fetch calls, headers, etc. to the API endpoints.

Thanks again and let me know via Telegram if you encounter any issues!

src/features/persistence/PersistenceUtils.tsx Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/commons/sagas/PersistenceSaga.tsx Outdated Show resolved Hide resolved
src/commons/sagas/PersistenceSaga.tsx Outdated Show resolved Hide resolved
src/features/persistence/PersistenceUtils.tsx Outdated Show resolved Hide resolved
src/pages/createStore.ts Outdated Show resolved Hide resolved
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.

5 participants