GoogleWebComponents / google-signin

Google Sign-in web component
https://elements.polymer-project.org/elements/google-signin
Other
279 stars 89 forks source link

[Request] Polymer 2.0 support #158

Open borisbsv opened 7 years ago

borisbsv commented 7 years ago

Most google web componets have a 2.0-preview branch. Is there a chance this will happen soon for the google-signin? Currently, after updating to Polymer 2.0 rc2, I get the following error on clicking the signin button: Uncaught Error: AuthEngine not initialized. gapi has not loaded. at Object.assertAuthInitialized (google-signin-aware.html:418) at Object.signIn (google-signin-aware.html:427) at HTMLElement.signIn (google-signin-aware.html:731) at HTMLElement.signIn (google-signin.html:558) at HTMLDivElement.handler (template-stamp.html:428)

AndrewBarfield commented 7 years ago

Same here I'm dead in the water...

I've added <script src="https://apis.google.com/js/platform.js"></script> to my index.html, but now the message is about 'auth2' not being loaded:

Uncaught Error: AuthEngine not initialized. auth2 not loaded. at Object.assertAuthInitialized (google-signin-aware.html:421) at Object.signIn (google-signin-aware.html:427) at HTMLElement.signIn (google-signin-aware.html:731) at HTMLElement.signIn (google-signin.html:558) at HTMLDivElement.handler (template-stamp.html:92) assertAuthInitialized @ google-signin-aware.html:421 signIn @ google-signin-aware.html:427 signIn @ google-signin-aware.html:731 signIn @ google-signin.html:558 handler @ template-stamp.html:92

I need to somehow have this working by Friday Apr 21. Eeeek!

krisu7 commented 6 years ago

@TemplarRei @AndrewBarfield add this to index.html:

<script src="https://apis.google.com/js/api.js"></script>
<script>
  function start() {
  // Initialize the JavaScript client library.
  gapi.client.init({
    'apiKey': '',
    // clientId and scope are optional if auth is not required.
    'clientId': '',
    'scope': ''})
  };
</script>

and in your module:

connectedCallback() {
  super.connectedCallback();
  // Load the JavaScript client library.
  gapi.load('client', start);
borisbsv commented 6 years ago

Thanks, @krisu7, we just restarted development on the migration and this should be quite helpful 👍

krisu7 commented 6 years ago

@TemplarRei You're welcome, I just had the same problem and this was only solution that worked for me.