-
Notifications
You must be signed in to change notification settings - Fork 213
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
feat(clerk-js,clerk-react,nextjs,types): Drop experimental tag from GoogleOneTap #3392
Conversation
🦋 Changeset detectedLatest commit: e97824f The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
public __experimental_authenticateWithGoogleOneTap = async ( | ||
params: __experimental_AuthenticateWithGoogleOneTapParams, | ||
): Promise<SignInResource | SignUpResource> => { | ||
return this.create({ | ||
// TODO-ONETAP: Add new types when feature is ready for public beta | ||
// @ts-expect-error | ||
strategy: 'google_one_tap', | ||
googleOneTapToken: params.token, | ||
}).catch(err => { | ||
if (isClerkAPIResponseError(err) && err.errors[0].code === 'external_account_not_found') { | ||
return SignIn.clerk.client?.signUp.create({ | ||
// TODO-ONETAP: Add new types when feature is ready for public beta | ||
// @ts-expect-error | ||
strategy: 'google_one_tap', | ||
googleOneTapToken: params.token, | ||
}); | ||
} | ||
throw err; | ||
}) as Promise<SignInResource | SignUpResource>; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved to Clerk.ts
authenticateWithGoogleOneTap = async ( | ||
params: AuthenticateWithGoogleOneTapParams, | ||
): Promise<SignInResource | SignUpResource> => { | ||
const clerkjs = await this.#waitForClerkJS(); | ||
return clerkjs.authenticateWithGoogleOneTap(params); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to highlight this change. This goes against the pattern we already have. But I cannot think of a reason why we cannot do this.
Description
Add support for GoogleOneTap. New APIs listed:
React component
<GoogleOneTap/>
Customize the UX of the prompt
Use the component from with Vanilla JS
Clerk.openGoogleOneTap(props: GoogleOneTapProps)
Clerk.closeGoogleOneTap()
Low level APIs for custom flows
await Clerk.authenticateWithGoogleOneTap({ token: 'xxxx'})
await Clerk.handleGoogleOneTapCallback()
We recommend using this two methods together in order and let Clerk to perform the correct redirections.
In case you want to handle the redirection and session management yourself you can do so like this
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change