Skip to content Skip to sidebar Skip to footer

Using Google-signin Without Metadata Tags

I am trying to use the google signin lib without the metadata tags. (explanation for this at the end) I largely seem to have this working but when my page loads I get an uncaught e

Solution 1:

Loading Google Sign-In button using declarative approach along with a framework tend to be a problem. I recommend you to try imperative approach.

I imagine you have

<divclass="g-signin2"></div>

and

<scriptsrc="https://apis.google.com/js/platform.js"></script>

What you should do is:

  1. Remove .g-signin2 and specify an id. Because the library auto-detects the g-signin2 and tries to replace it with a button widget.
  2. Using JavaScript, bind a function to the button which invokes a manual sign-in.
  3. Do manual initialization when you feel comfortable (for example, after the framework is completely loaded). The client id can be included as part of auth2.init() params.

You can find details here. https://developers.google.com/identity/sign-in/web/build-button

FWIW, you can use https://apis.google.com/js/api.js instead of platform.js. platform.js is for when you want to use widgets.

Post a Comment for "Using Google-signin Without Metadata Tags"