Skip to content

feat: add Google One Tap modal #1117

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

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

Conversation

darcyYe
Copy link
Contributor

@darcyYe darcyYe commented May 27, 2025

Summary

add Google One Tap modal, resolves LOG-11503

@darcyYe darcyYe requested review from a team and Copilot May 27, 2025 03:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a Google One Tap modal to the documentation site by integrating a new configuration fetch and rendering mechanism in the Layout wrapper. Key changes include introducing a zod schema for config validation, caching of the fetched configuration, and updating the Docusaurus configuration to include the Google One Tap script and API base URL custom field.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
src/theme/Layout/index.tsx Adds LayoutWrapper component for fetching and rendering Google One Tap modal.
package.json Adds the "zod" dependency used for runtime config validation.
docusaurus.config.ts Injects the Google One Tap client script and adds a custom field for the API base URL.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported


setConfig(validatedConfig);
} catch (error) {
console.error('Error fetching or validating Google One Tap config:', error);
Copy link
Preview

Copilot AI May 27, 2025

Choose a reason for hiding this comment

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

Consider implementing a graceful fallback UI or user notification in case the config fetch fails rather than only logging the error.

Suggested change
console.error('Error fetching or validating Google One Tap config:', error);
console.error('Error fetching or validating Google One Tap config:', error);
setFetchError(true);

Copilot uses AI. Check for mistakes.

id="g_id_onload"
data-client_id={config.clientId}
// TODO: implement handleCredentialResponse page
data-callback="handleCredentialResponse"
Copy link
Preview

Copilot AI May 27, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding documentation or clarifying the TODO for the 'handleCredentialResponse' callback to guide future implementations.

Copilot uses AI. Check for mistakes.

Copy link

cloudflare-workers-and-pages bot commented May 27, 2025

Deploying logto-docs-tutorials with  Cloudflare Pages  Cloudflare Pages

Latest commit: aeacafe
Status: ✅  Deploy successful!
Preview URL: https://21f8731a.logto-docs-tutorials.pages.dev
Branch Preview URL: https://yemq-add-local-google-one-ta.logto-docs-tutorials.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented May 27, 2025

Deploying logto-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: aeacafe
Status: ✅  Deploy successful!
Preview URL: https://c2e354ab.logto-docs.pages.dev
Branch Preview URL: https://yemq-add-local-google-one-ta.logto-docs.pages.dev

View logs

@darcyYe darcyYe marked this pull request as ready for review May 29, 2025 04:03
@darcyYe darcyYe force-pushed the yemq-add-local-google-one-tap branch from 2b9f070 to 1d52165 Compare June 23, 2025 08:43
@darcyYe darcyYe force-pushed the yemq-add-local-google-one-tap branch from cea2bd3 to 2f1ff0e Compare June 30, 2025 14:00
Copy link
Member

@gao-sun gao-sun left a comment

Choose a reason for hiding this comment

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

needs more review

darcyYe added 4 commits July 22, 2025 14:52
* feat: check auth status on cloud console

* refactor: refactor code

* fix: fix page

* chore: fix content not render bug

* chore: resume least changes

* refactor: apply try-retry instead of polling

* refactor: use google API instead of HTML component

* revert: restore pnpm-lock.yaml to base branch version

* refactor: apply browser only to GOT and add referrer policy header

* refactor: apply thorough CSP

* feat: add GOT callback handler (#1166)

* feat: add GOT callback handler

* fix: fix CSP, refactor GOT credential verifier

* chore: test GET verify API

* chore: use otp landing page

* chore: add frame-ancestor config

* chore: pop up fallback mechanism

* chore: redirect in-place and try POST

* chore: test without CSP headers for CF

* chore: test experience google credential

* chore: add debug log and check/grant storage access

* chore: update console landing page

* refactor: remove unnecessary code

* feat: only trigger GOT once

* chore: remove unused code

* refactor: refactor code
@darcyYe darcyYe force-pushed the yemq-add-local-google-one-tap branch from f22a447 to 3ea4b73 Compare July 22, 2025 07:42
@darcyYe darcyYe force-pushed the yemq-add-local-google-one-tap branch from 3ea4b73 to 492e8dc Compare July 22, 2025 08:36
@darcyYe darcyYe force-pushed the yemq-add-local-google-one-tap branch 8 times, most recently from c31a207 to 5d674d9 Compare July 25, 2025 04:54
@darcyYe darcyYe force-pushed the yemq-add-local-google-one-tap branch from 5d674d9 to 8102b7d Compare July 25, 2025 07:45
@darcyYe darcyYe force-pushed the yemq-add-local-google-one-tap branch from 8102b7d to aeacafe Compare July 25, 2025 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants