Comments (13)
I have seen this error randomly but have not be able to reproduce it. Do you have repo steps and does it keep you from authenticating?
from react-google-login.
No, it doesn't prevent authentication, it's just a warning. My implementation is more or less identical to the docs, maybe it's environment specific. I'll see if I can set up a jsFiddle.
Surely it's just a matter of heeding the warning itself, though? Do you call gapi.auth2.init()
or gapi.auth2.getAuthInstance()
in the source code?
from react-google-login.
It uses both. It sounds like it is calling gapi.auth2.init()
when it shouldn't be or is called with different options. Let me know if you can give me repo steps or a link to so we can figure out the scenario which the error is occurring.
from react-google-login.
Sure, do you have a demo clientId
to use?
from react-google-login.
Ah, I see you've got one in the demo. In that case, here's my implementation:
<GoogleLogin
style={styles.googleBtn}
buttonText='Login with Google'
callback={this.handleGoogleLogin}
clientId='658977310896-knrl3gka66fldh83dao2rhgbblmd4un9.apps.googleusercontent.com'
cssClass='btn btn-block btn-lg btn-default'
/>
from react-google-login.
Basically, it looks like it's happening because your source code is trying to init gapi twice. If I hard reload the page and am not logged into Google, everything looks good. Then I log in. From this point onwards, anytime I come back to this route (eg the component is rendered again) it produces the error because it keeps trying to init gapi.
Why do you use both? The warning seems to indicate if you just stick with gapi.auth2.getAuthInstance()
you won't have a problem.
from react-google-login.
Can you host it somewhere? With it showing the issue. I have a hosted implementation here but it does not show the error: http://reactstarter.founderstack.io/register
from react-google-login.
It needs Init, if you are not auth'd yet. So it is happening when you hit that page even though you already authenticated? I guess I need a way to check if auth'd before calling init()
from react-google-login.
Did you mean to link to that registration page...?
It's hard to host this kind of stuff, jsFiddle and requirebin don't suffice and don't support ES6/npm.
Basically what you're saying is right; you need to check gapi.auth2.getAuthInstance()
before calling gapi.auth2.init()
. Should be a simple fix, also happy to submit a PR.
from react-google-login.
I am traveling right now so wouldn't be able to look at the PR until next weekend but would be great if you could submit one for this.
from react-google-login.
Sure, but what port do you use for local testing? Tried booting the project up on 3000 and got the redirect_uri_mismatch
error. Need to know exactly what you've specified the origin to be in your google dev console.
from react-google-login.
Would have to look. Just use your own clientId.
from react-google-login.
I addressed this in PR #12.
from react-google-login.
Related Issues (20)
- SignIn is deprecated for new client application HOT 9
- This document requires 'TrustedScript' assignment. HOT 1
- React 18 HOT 14
- Is the "sub" identifier permanent for particular google account? HOT 2
- The login button is disabled everytime while implementing on next.js. But works fine in terms of react.js. Does this package have support for next? HOT 1
- could not peer react@"^16 || ^17" from [email protected] HOT 12
- popup_closed_by_user HOT 13
- Missing required parameter HOT 4
- Google deprecation-warning HOT 3
- include_granted_scopes default set to true
- Not compatible with React 18 HOT 1
- Not able to filter emails HOT 3
- Still maintained? HOT 2
- 403: Request had insufficient authentication scopes.
- Error "popup_closed_by_user" HOT 3
- OnFailure Method is silently called when page loads and when successfully logged in to Google. HOT 1
- user authentication or authorization deprecation issue HOT 2
- login button is disabled in Production HOT 5
- Migrate to Google Identity Services from Google Sign-In JavaScript library HOT 1
- Please Archive this repo !
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-google-login.