2

これは iOS にのみ適用されます。pc/mac ブラウザは問題ないようです。

そのため、Google Plus API は素晴らしく機能します...ユーザーが chrome にログインしている限り。ユーザーが自分の iPhone または Chrome で Safari を使用して私のサイトにアクセスし、ログインしていない場合、サインイン ボタンは何もしません。何もクリックしません。

基本的に API サイトから直接取得した html を次に示します。

<span id="signinButton" class="span12">
<span
    class="g-signin"
    data-callback="onSigninCallback"
    data-clientid="771400051000-sh72h9d1tu6h14cuvtmt0ohm8ovd7o09.apps.googleusercontent.com"
    data-cookiepolicy="single_host_origin"
    data-requestvisibleactions="http://schemas.google.com/AddActivity"
    data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email">
</span>

そして、ここにjavascriptがあります。問題ではないと思うので、ヘルパー関数は含めません。私は、彼らが呼び出されただけでうまくいくと思います.問題は、クロムにログインしていないときに onSignInCallback が authResult を取得することにあるに違いないと思います. 詳細が必要な場合は、お問い合わせください:)

onSignInCallback: function(authResult) {
  gapi.client.load('plus','v1', function(){
    $('#authResult').html('Auth Result:<br/>');
    for (var field in authResult) {
      $('#authResult').append(' ' + field + ': ' +
          authResult[field] + '<br/>');
    }
    if (authResult['access_token']) {
      $('#authOps').show();
      $('#gConnect').hide();
      var email_promise = helper.email();
      email_promise.done(function(email_result) {
            helper.profile(email_result);
        });


    } else if (authResult['error']) {
      // There was an error, which means the user is not signed in.
      // As an example, you can handle by writing to the console:
      console.log('There was an error: ' + authResult['error']);
      $('#authResult').append('Logged out');
      $('#authOps').hide('slow');
      $('#gConnect').show();
    }
    console.log('authResult', authResult);
  });
}
4

0 に答える 0