This content originally appeared on CodeSource.io and was authored by Deven
If you are facing this issue, Gapi is not defined – Google sign-in issue with gapi.auth2.Init, The most common problem is you have async and defer attributes on your script tag. Please note that gapi should be loaded after your script tag with gapi.auth2.init
.
Consider the example below:
<script src="https://apis.google.com/js/platform.js?onload=onLoadCallback" async defer></script>
<script>
window.onLoadCallback = function(){
gapi.auth2.init({
client_id: 'You_client_Id_HERE.apps.googleusercontent.com'
});
}
</script>
In the snippet above to wait for gapi
before executing the code you have to use onload query param in the script tag.
The post Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Deven
Deven | Sciencx (2021-02-11T06:57:37+00:00) Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init. Retrieved from https://www.scien.cx/2021/02/11/fix-gapi-is-not-defined-google-sign-in-issue-with-gapi-auth2-init/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.