Skip to content

Add support for dynamic callback URL in Google sign-in flow#481

Merged
Marfuen merged 1 commit into
mainfrom
mariano/callback
Apr 29, 2025
Merged

Add support for dynamic callback URL in Google sign-in flow#481
Marfuen merged 1 commit into
mainfrom
mariano/callback

Conversation

@Marfuen
Copy link
Copy Markdown
Contributor

@Marfuen Marfuen commented Apr 29, 2025

What does this PR do?

  • Fixes #XXXX (GitHub issue number)
  • Fixes COMP-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

Copilot AI review requested due to automatic review settings April 29, 2025 19:58
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2025 8:01pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
comp-portal ⬜️ Skipped (Inspect) Apr 29, 2025 8:01pm

Copy link
Copy Markdown
Contributor

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 support for a dynamic callback URL in the Google sign-in flow.

  • Dynamically builds the callback URL from the provided redirect path and the current window location.
  • Passes the generated URL string to the auth client’s social sign-in method.

Comment on lines +26 to +30
const callbackURL = new URL(redirectTo, window.location.origin);

await authClient.signIn.social({
provider: "google",
callbackURL: callbackURL.toString(),
Copy link

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider inlining the URL conversion if the variable is only used once (e.g., directly passing new URL(redirectTo, window.location.origin).toString() to authClient.signIn.social), or add a clarifying comment if keeping the variable improves readability.

Suggested change
const callbackURL = new URL(redirectTo, window.location.origin);
await authClient.signIn.social({
provider: "google",
callbackURL: callbackURL.toString(),
await authClient.signIn.social({
provider: "google",
callbackURL: new URL(redirectTo, window.location.origin).toString(),

Copilot uses AI. Check for mistakes.
@Marfuen Marfuen merged commit 6a4e00e into main Apr 29, 2025
9 checks passed
@Marfuen Marfuen deleted the mariano/callback branch April 29, 2025 21:57
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