-
Notifications
You must be signed in to change notification settings - Fork 21
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
Cannot read properties of undefined (reading 'init') #29
Comments
Getting the same! 😢 |
Looks like this is getting deprecated: https://developers.googleblog.com/2021/08/gsi-jsweb-deprecation.html |
Then how to solve this problem? who has a good code example? |
Getting the same issue @naumansigma added. |
Guys, please take a look of the google oauth doc https://developers.google.com/identity/sign-in/web/sign-in?hl=es-419 |
I also faced this issue as this method is deprecated. I have re wrote my code with new flow
more about google credential https://developers.google.com/identity/gsi/web/reference/js-reference#CredentialResponse
more render button options https://developers.google.com/identity/gsi/web/reference/js-reference#GsiButtonConfiguration |
M getting error - > Property 'accounts' does not exist on type 'typeof google' Any idea at this line window.google.accounts |
@suresh-webonise |
any help here |
Not fixed
Its a defer error
Removed in the script file
…On Thu, 2 Mar 2023, 4:18 pm Myke Miroshnikov, ***@***.***> wrote:
@uzairsaddique <https://github.com/uzairsaddique> it is a TypeScript
error. You can use @ts-ignore to fix it for now.
—
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGLZQHYSEDYIO2VGJ3AYPJDW2B6Z7ANCNFSM6AAAAAAVFUUFYM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hey this is an issue for us too, did anyone find a package version which works here or found a pin that would fix the above error? |
@uzairsaddique @krubot-sky
|
Got it, thanks!
…On Thu, 2 Mar 2023, 6:37 pm Tushar Kolhe, ***@***.***> wrote:
@uzairsaddique <https://github.com/uzairsaddique> @krubot-sky
<https://github.com/krubot-sky>
try remove defer and async
make sure script is loaded <script src="
https://accounts.google.com/gsi/client"></script>
or you can check if the script is loaded
useEffect(() => {
const init = () => {
// pass the callback function created in step 3
window.google.accounts.id.initialize({
client_id: process.env.REACT_APP_GOOGLE_CLIENT_ID_LOGIN,
callback: handleCredentialResponse,
});
};
// add a check here
if(window.google){ <<<<--------- add this condition
init();
// initiate a pop up to login
window.google.accounts.id.prompt();
// render login button
// use the element ID created in step 2
window.google.accounts.id.renderButton(
document.getElementById("googleSignInButton"),
{ theme: "outline", size: "large", width: "310px" }
);
}
}, [window.google]); <<<<--------- add this dependency
—
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGLZQH4VB2GBL4EIWML2DDDW2CPBPANCNFSM6AAAAAAVFUUFYM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I used this package instead: |
@hyperparameters useEffect will not work for everybody because Instead of a
Taken from Google on this part of their docs: https://developers.google.com/identity/gsi/web/guides/display-button?authuser=3&hl=pt#button_rendering |
No description provided.
The text was updated successfully, but these errors were encountered: