Even more common errors with Sign-in

After a few months of debugging other people’s code and seeing real-world integrations, I have encountered some strange issues that have baffled me but that had frustratingly simple solutions!  Here are a few more that we hadn’t yet encountered when we had launched but that came up over our integrations in bootcamps with Google+ partners.  If you encounter other errors, please let me know on Google+!

Getting 401 errors but my sign-in button is including the right visible actions, what gives?

Here is an interesting situation… What could be happening is that users are connecting to your application with the interactive post button and the callback is different from the sign-in button.  What you need to take to heart here is that the interactive post button IS a sign-in button.  Match your scopes, match requestvisibleactions, and know that the callback will be triggered when the interactivepost button loads.  Here’s an example of a Sign-in button and interactive post button with matching scopes:

  <script type="text/javascript">
  function renderPost(){
    var options = {
      scope: 'https://www.googleapis.com/auth/plus.login',
      requestvisibleactions: 'http://schemas.google.com/AddActivity',
      contenturl: 'https://plus.google.com/+GusClass',
      clientid: '671005127968.apps.googleusercontent.com',
      cookiepolicy: 'single_host_origin',
      prefilltext: 'Attack the evil Gus!!!',
      calltoactionlabel: 'ATTACK',
      calltoactionurl: 'https://plus.google.com/+GusClass',
      recipients: '109716647623830091721'
    // Call the render method when appropriate within your app to display
    // the button.
    gapi.interactivepost.render('sharePost', options);
  <span id="signinButton">
  <div id="sharePost"><button>Attack</button></div>

  <script type="text/javascript">
    (function() {
      var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
      po.src = 'https://apis.google.com/js/client:plusone.js?onload=renderPost';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);


Getting 400 errors when writing app activities

Another interesting situation 🙂  This happens when you are writing app activities and you have added extra payloads or are missing requisite data. If, for example, you have an App activity that looks like the following target-less payload in JavaScript:

      var payload = {
        "startDate": "2012-10-31T23:59:59.999Z"

        payload.target = {
          "id" : "replacewithuniqueidforaddtarget",
          "theGusField" : "Just doin Gus stuff",
          "image" : "http://www.google.com/s2/static/images/GoogleyEyes.png",
          "type" : "http://schema.org/CreativeWork",
          "description" : "The description for the activity",
          "name":"An example of AddActivity"


“theGusField” will cause the write to return a 400.  Remove the extra field and you will successfully be returned an object.  This is just one more reason that you should be using the targeturl field and taking advantage of Schema for populating your share content.


Getting 403 errors on an API call

This means that you have not enabled a particular service for that API call in your APIs console.  Let’s say that you’re trying to make an API call to Google+ but your client hasn’t fully been configured yet, you would get this error.

To fix it…

Go to the Google APIs console and select the services tab.

Ensure that you have enabled Google+ (or whatever API you are accessing…) and these errors will go away!

For more information