I'm using the Google+ badge API to get followers and + 1s In addition, I have a signin button using the Google+ Signin API. When I login using the signin button, this email asks for permission. But, when I want to follow or +1 a Google+ page, I ask to login and never asks for permission. Is there a way where I can ask users to follow up and login using the +1 button? In addition to this, if a user conflicts with his / her profile field (like birthday) for 'only me', can I request those areas? if so, how? 1- No badge API. 2- You should distinguish between - using Google functionality such as a badge or +1 button, which the user needs to sign in to Google+ - the functionality of your service, just like the sign-in button Using which user needs to connect to Google+ At least a user must sign in to Google+ (which does not require any permission because of the Google+ identity provider) and Connect T Your service / site / app for which you need to allow. & lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Demo: Get an email address using the Google+ Sign-In button & lt; / Title & gt; & Lt; Style type = "text / css" & gt; .hide {display: none;} .show {display: block;} & lt; / Style & gt; & Lt; Script src = "https://apis.google.com/js/plusone.js" type = "text / javascript" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; / * * Triggers when users sign in, cancel, or turn off * the authorization dialog * / function LoginFooted callback {if (authResult) {if (authResult ['error'] == Undefined) {gapi.auth.setToken (authResult); // Store back tokens toggleElement ('sign-in button'); // Hide the sign-in button after successfully signing in to the user. GetEmail (); // Trigger request to get email address } And {console.log ('an error occurred'); }} And {console.log ('Empty Writer'); // something went wrong}} / * * Starts the request for Android Android for the user's email. This function relies on gapi.auth.setToken, which includes a valid * OAuth access token. * * When the request is complete, getEmailCallback has started and the results of the request are passed *. * / Function getEmail () {// load O2 libraries to load user interface methods Gapi.client.load ('oauth2', 'v2', function () {var request = gapi.client.oauth2. Userinfo.get (); request.execute (getEmailCallback);}); // This sample assumes that a client object has been created. To learn more about creating a // client, see the starter: // https://developers.google.com/+/quickstart/javascript gapi.client.load ('plus', 'v1', function () { Var request = gapi.client.plus.people.list ({'userId': 'me', 'archive': 'visible'}); request.execute (function) {console.log ('number people appear Are: 'Resp.totalItems);});}); // This sample assumes that a client object has been created. To learn more about creating a // client, see the starter: // https://developers.google.com/+/quickstart/javascript gapi.client.load ('plus', 'v1', function () { Var request = gapi.client.plus.people.get ({'userId': 'me'}); request.execute (resp) {console.log ('Recover Profile for:' resp.displayName); Console .log (resp);});}); } GetEmailCallback function (obj) {varel = document.getElementById ('email'); Var email = ''; If (obj ['email']) {email = 'email:' + obj ['email']; } //console.log (obj); // Inability to inspect the whole object El.innerHTML = Email; ToggleElement ('e-mail'); } Function toggle element (id) {var el = document.getElementById (id); If (el.getAttribute ('Class') == 'hide' (el.setAttribute ('class', 'show');} Else {el.setAttribute ('class', 'hide');}} & Lt ; / Script> gt; & gt; & lt; body & gt; & lt; div id = "signin-button" class = "show" & gt; div class = "g-signin "Data-callback =" login full callback "data-client =" MY_CLIENT_ID "data-scope =" https://www.googleapis.com/auth/plus.login https: // www. Googleapis.com/auth/userinfo .profile https://www.googleapis.com/auth/userinfo.email "Data-height =" small "data-cookie policy =" single_host_corein "& gt; & lt; / div & gt; & lt; / div & gt; ; & Lt;! - Keep this tag where you want to render the badge - & gt; & lt; div class = "g- Plus "data-width =" 210 "data-href =" // plus.google.com/MY_PAGE_ID "data-relay =" publisher "data-theme =" dark "& gt; & lt; / div & gt; Lt; div id = "email" class = "hide">
No comments:
Post a Comment