Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Google Sign in

  1. #1
    Join Date
    Feb 2017
    Location
    Behind the keyboard
    Posts
    10

    Default Google Sign in

    I am trying to add a google sign in to my site
    https://developers.google.com/identi...fore_you_begin
    I followed that and got my client id etc
    then I inserted the code in a placeholder

    heres my code
    HTML Code:
    <html lang="en">
      <head>
        <meta name="google-signin-scope" content="profile email">
        <meta name="google-signin-client_id" content="*************************************.apps.googleusercontent.com">
        <script src="https://apis.google.com/js/platform.js" async defer></script>
      </head>
      <body>
        <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
        <script>
          function onSignIn(googleUser) {
            // Useful data for your client-side scripts:
            var profile = googleUser.getBasicProfile();
            console.log("ID: " + profile.getId()); // Don't send this directly to your server!
            console.log('Full Name: ' + profile.getName());
            console.log("Email: " + profile.getEmail());
    
            // The ID token you need to pass to your backend:
            var id_token = googleUser.getAuthResponse().id_token;
            console.log("ID Token: " + id_token);
          };
        </script>
      </body>
    </html>
    When I preview whole site it renders the button which does nothing.
    Am I missing something or overlooking?

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,499

    Default Re: Google Sign in

    Did you paste the head portion in the head portion of the placeholder? And the body in the body section?

    Do not paste the head or body tags.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	placeholder.png 
Views:	67 
Size:	72.0 KB 
ID:	120272  

  3. #3
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,499

    Default Re: Google Sign in

    Also, there are some variable in the script that need to be added, I saw gmail account. There might be more.

  4. #4
    Join Date
    Feb 2017
    Location
    Behind the keyboard
    Posts
    10

    Default Re: Google Sign in

    your talking about the head and body in the place holder.

  5. #5
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,499

  6. #6
    Join Date
    Feb 2017
    Location
    Behind the keyboard
    Posts
    10

    Default Re: Google Sign in

    placed code in head and body, when i preview site the cousor turns to a finger like its a link but still not clickable etc

    placed in the head
    HTML Code:
     <meta name="google-signin-scope" content="profile email">
     <meta name="google-signin-client_id" content="***************************************.apps.googleusercontent.com">
     <script src="https://apis.google.com/js/platform.js" async defer></script>
    placed in the body
    HTML Code:
     <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
     <script>
      function onSignIn(googleUser) {
      // Useful data for your client-side scripts:
       var profile = googleUser.getBasicProfile();
       console.log("ID: " + profile.getId()); // Don't send this directly to your server!
       console.log('Full Name: ' + profile.getName());
       console.log('Given Name: ' + profile.getGivenName());
       console.log('Family Name: ' + profile.getFamilyName());
       console.log("Image URL: " + profile.getImageUrl());
       console.log("Email: " + profile.getEmail());
      // The ID token you need to pass to your backend:
        var id_token = googleUser.getAuthResponse().id_token;
        console.log("ID Token: " + id_token);
          };

  7. #7
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,499

    Default Re: Google Sign in

    Maybe Acorn or one of the other members who know more about coding than I do can help you with this.

  8. #8
    Join Date
    Aug 2010
    Posts
    533

    Default Re: Google Sign in

    All the script is doing is console.log user data. This is just an example script how data can be retrieved from googles API. You would need to look at the docs to develop it further.

  9. #9
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,805

    Default Re: Google Sign in

    Quote Originally Posted by gwpriester View Post
    Maybe Acorn or one of the other members who know more about coding than I do can help you with this.
    I went to the offered Google developers site and tried changing items from their suggestions but I couldn't get the OP's version or their's to present a button let along have a failed click. I also don't understand the synergy of using this with a Xara site. Does it allow a log-in to proceed? Xara sites don't support server code so I am confused and no help.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  10. #10
    Join Date
    Aug 2010
    Posts
    533

    Default Re: Google Sign in

    Quote Originally Posted by Acorn View Post
    I went to the offered Google developers site and tried changing items from their suggestions but I couldn't get the OP's version or their's to present a button let along have a failed click. I also don't understand the synergy of using this with a Xara site. Does it allow a log-in to proceed? Xara sites don't support server code so I am confused and no help.

    Acorn
    The OP would have to write his own script to get the login to proceed.

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •