-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
022223e
commit fcc349c
Showing
26 changed files
with
601 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
'@clerk/nextjs': minor | ||
'@clerk/clerk-react': minor | ||
--- | ||
|
||
Add support for GoogleOneTap | ||
### React component | ||
- `<GoogleOneTap/>` | ||
|
||
Customize the UX of the prompt | ||
|
||
```tsx | ||
<GoogleOneTap cancelOnTapOutside={false} itpSupport={false} fedCmSupport={false}/> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
'@clerk/clerk-js': minor | ||
--- | ||
|
||
### Use the Google One Tap component from with Vanilla JS | ||
- `Clerk.openGoogleOneTap({ cancelOnTapOutside: false, fedCmSupport: false, itpSupport: false })` | ||
- `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 perform the correct redirections. | ||
```tsx | ||
google.accounts.id.initialize({ | ||
callback: async response => { | ||
const signInOrUp = await Clerk.authenticateWithGoogleOneTap({ token: response.credential}) | ||
await Clerk.handleGoogleOneTapCallback(signInOrUp, { | ||
afterSignInUrl: window.location.href, | ||
}) | ||
}, | ||
}); | ||
``` | ||
|
||
In case you want to handle the redirection and session management yourself you can do so like this | ||
```tsx | ||
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 | ||
}) | ||
} | ||
}, | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@clerk/chrome-extension': minor | ||
--- | ||
|
||
Update export snapshot tests to include `GoogleOneTap`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
'@clerk/types': minor | ||
--- | ||
|
||
Added the following types | ||
```tsx | ||
interface Clerk { | ||
... | ||
openGoogleOneTap: (props?: GoogleOneTapProps) => void; | ||
closeGoogleOneTap: () => void; | ||
authenticateWithGoogleOneTap: (params: AuthenticateWithGoogleOneTapParams) => Promise<SignInResource | SignUpResource>; | ||
handleGoogleOneTapCallback: ( | ||
signInOrUp: SignInResource | SignUpResource, | ||
params: HandleOAuthCallbackParams, | ||
customNavigate?: (to: string) => Promise<unknown>, | ||
) => Promise<unknown>; | ||
... | ||
} | ||
|
||
type GoogleOneTapStrategy = 'google_one_tap' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.