logo
Tutorials
Code examples
Courses
Dev Tips
Errors solved
Snippets
Technical writing program
AndroidAngularBeginnersBlockchainBootstrapCakePHPCode examplesCodeIgniterCoursesCSSDev TipsDjangoElectronErrors solvedFlaskFlutterGitGoLangGraphQlJavaJavascriptJqueryKotlinLaravelMachine LearningMySQLNodePhalconPHPPreactPythonReactReact NativeSnippetsspring bootSQLSvelteSymfonyTutorialsUncategorizedVue

error solved

Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init

Posted on: February 11, 2021 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.

Related Posts:

  • Create a Sleek Note app With Flutter
  • Build a CRUD Application with Hasura and Vue-Apollo
  • CI/CD with GitHub, Travis CI, and Heroku
  • Building a blogging platform Using React, GraphQL, And…
  • Build a CRUD application in Golang with PostgreSQL
  • Building an eCommerce storefront using Gridsome and GraphCMS
  • complete Guide to Local storage in Javascript
  • Getting started with Vue & Apollo GraphQL
  • Build A Desktop Application with Vuejs and Electronjs
  • Building A CRUD Application with Svelte
  • Understanding Firebase Realtime Database using React
  • Setting Up Angular Authentication Using JWT
  • Handling Vue Authentication using GraphQL API
  • Setting up Vue Authentication using Expressjs, MongoDB, and…
  • Advance model filtering using Laravel when method


category :

Errors solved

tag :

error

Share on social media

//
PreviousNext
Deven

About the author

Deven
Deven is an Entrepreneur, and Full-stack developer, Constantly learning and experiencing new things. He currently runs CodeSource.io and Dunebook.com
See all posts

Useful front-end & UX tips, delivered once a week.

Useful front-end & UX tips, delivered once a week. 🎁




Dev Tips

How To Create NFT Ar

January 14, 2022

How To Create NFT Art With No Coding Experience​

Collection of the 20

October 13, 2021

Collection of the 20 useful Python Scripts

No Code Development

October 1, 2021

No Code Development As An Alternative For Programming

Top 4 Best Programmi

August 4, 2021

Top 4 Best Programming Languages for Beginner

How to prepare for a

July 16, 2021

How to prepare for a Data Science interview?

Code Examples

How to concatenate t

March 3, 2022

How to concatenate two lists in python

How to use math.log(

March 3, 2022

How to use math.log() function in Python

How to add a new ite

March 2, 2022

How to add a new item to a python dictionary

How to use switch st

March 2, 2022

How to use switch statement in React

How to use whereIn()

February 23, 2022

How to use whereIn() method in Laravel

Errors Solved

How to fix module no

February 4, 2022

How to fix module not found: can’t resolve in React

How to fix Vscode in

February 2, 2022

How to fix Vscode indentation

How to fix MongoErro

December 24, 2021

How to fix MongoError:e11000 duplicate key error collection

How to fix vue packa

December 24, 2021

How to fix vue packages version mismatch

How to fix typeerror

December 24, 2021

How to fix typeerror: $ is not a function in JavaScript

Contact
Guest writing
Copyright
Privacy
Dunebook
Learn React and React Native
AndroidAngularBeginnersBlockchainBootstrapCakePHPCode examplesCodeIgniterCoursesCSSDev TipsDjangoElectronErrors solvedFlaskFlutterGitGoLangGraphQlJavaJavascriptJqueryKotlinLaravelMachine LearningMySQLNodePhalconPHPPreactPythonReactReact NativeSnippetsspring bootSQLSvelteSymfonyTutorialsUncategorizedVue

© 2022 Codesource.io