javascript
javascript copied to clipboard
feat(clerk-js,clerk-react,nextjs,types): Drop experimental tag from GoogleOneTap
Description
Add support for GoogleOneTap. New APIs listed:
React component
<GoogleOneTap/>
Customize the UX of the prompt
<GoogleOneTap
cancelOnTapOutside={false}
itpSupport={false}
fedCmSupport={false}
/>
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.
google.accounts.id.initialize({
callback: async response => {
const signInOrUp = await Clerk.authenticateWithGoogleOneTap({ token: response.credential})
await Clerk.handleGoogleOneTapCallback(signInOrUp, {
signInForceRedirectUrl: window.location.href,
})
},
});
In case you want to handle the redirection and session management yourself you can do so like this
google.accounts.id.initialize({
callback: async response => {
const signInOrUp = await Clerk.authenticateWithGoogleOneTap({ token: response.credential})
if(signInOrUp.status === 'complete') {
await Clerk.setActive({
session: signInOrUp.createdSessionId
})
}
},
});
Checklist
- [ ]
npm testruns as expected. - [ ]
npm run buildruns as expected. - [ ] (If applicable) JSDoc comments have been added or updated for any package exports
- [ ] (If applicable) Documentation has been updated
Type of change
- [ ] 🐛 Bug fix
- [ ] 🌟 New feature
- [ ] 🔨 Breaking change
- [ ] 📖 Refactoring / dependency upgrade / documentation
- [ ] other:
🦋 Changeset detected
Latest commit: e97824f5886a0a017c377893c8f7e84a25ad2d7e
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 14 packages
| Name | Type |
|---|---|
| @clerk/clerk-js | Minor |
| @clerk/nextjs | Minor |
| @clerk/clerk-react | Minor |
| @clerk/types | Minor |
| @clerk/chrome-extension | Patch |
| @clerk/clerk-expo | Patch |
| @clerk/elements | Patch |
| @clerk/remix | Patch |
| @clerk/backend | Patch |
| @clerk/express | Patch |
| @clerk/fastify | Patch |
| @clerk/clerk-sdk-node | Patch |
| @clerk/testing | Patch |
| @clerk/themes | Patch |
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