GmailApiQuickstart -

后端 未结 2 2094
失恋的感觉
失恋的感觉 2021-02-12 16:46

I am embarrassed that I\'m simply failing with an example piece of code, but I\'ll blame it on the fact that it is late...

I have taken a copy and paste of: https://deve

2条回答
  •  不要未来只要你来
    2021-02-12 17:06

    Right, after some more research (asking a colleague/genius), I found the problem. Basically the GoogleClientSecrets object was not being properly bound with the information from my client_secrets.json file. This meant that during authentication, objects were null resulting in the IllegalArgumentException.

    So the original file which looked like this:

    {
          "private_key_id": "zzz",
          "private_key": "-----BEGIN PRIVATE KEY-----\nxyz\n-----END PRIVATE KEY-----\n",
          "client_email": "1234@developer.gserviceaccount.com",
          "client_id": "1wdfghyjmp.apps.googleusercontent.com",
          "type": "service_account"
    }
    

    was edited to look like this:

    {
        "web" : {
          "private_key_id": "zzz",
          "private_key": "-----BEGIN PRIVATE KEY-----\nxyz\n-----END PRIVATE KEY-----\n",
          "client_email": "1234@developer.gserviceaccount.com",
          "client_id": "1wdfghyjmp.apps.googleusercontent.com",
          "type": "service_account"
        }
    }
    

    This allowed me to progress through the code with authentication.

    Hope this helps.

提交回复
热议问题