Skip to content
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

fix: Google One Tap callback response error #83

Merged
merged 4 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/GoogleSignInButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ watchEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
client_id: clientId!,
callback: (credentialResponse: CredentialResponse) => {
if (!credentialResponse.clientId || !credentialResponse.credential) {
if (!credentialResponse.credential) {
emits("error");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useOneTap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export default function useOneTap(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
client_id: clientId!,
callback: (credentialResponse: CredentialResponse) => {
if (!credentialResponse.clientId || !credentialResponse.credential) {
if (!credentialResponse.credential) {
onError?.();
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ export interface CredentialResponse {
select_by?: SelectBy;

/**
* Client ID returned from google
* This field is only defined when user clicks a Sign in with Google button to sign in, and the button's state attribute is specified.
*
* @type {string}
* @memberof CredentialResponse
*/
clientId?: string;
state?: string;
}

/**
Expand Down