OAuth2 invalid_grant: Malformed auth code (Google Sheets API)

Brian Milby brian at milby7.com
Thu Jul 9 22:03:04 EDT 2020


I can’t take all the credit.  I just found the bug report (with a solution listed) and submitted the PR.  Ran into the same issue trying to use the Google Calendar API.

Sent from my iPhone

> On Jul 9, 2020, at 6:19 PM, David Bovill via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Ah - makes sense. Thanks for spotting that Brian.
>> On 9 Jul 2020, 14:15 +0100, Ben Rubinstein via use-livecode <use-livecode at lists.runrev.com>, wrote:
>> Thanks Brian!
>> 
>> I've patched my copy for now. What a PITA.
>> 
>> Ben
>> 
>>> On 09/07/2020 13:29, Brian Milby via use-livecode wrote:
>>> Check out bug 22557 / PR 7381.
>>> 
>>> Line 247 of oath2.livecodescript need urlEncode removed
>>> 
>>> Sent from my iPad
>>> 
>>>> On Jul 9, 2020, at 7:33 AM, Ben Rubinstein via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>> 
>>>> I had code that did stuff with Google sheets, it worked fine, I haven't used it for about nine (?) months. Now it doesn't work.
>>>> 
>>>> To cut a long story short, I've started all over again on a clean base.
>>>> 
>>>> Created a new Client ID at
>>>> https://console.developers.google.com/apis/api/sheets.googleapis.com/credentials
>>>> 
>>>> Make the call to Oauth2, with all the parameters from the Google creds, get a suitable authorisation screen, all seems to go OK. But the result (i.e. 'it') is set to the array:
>>>> error: invalid_grant
>>>> error_description: Malformed auth code.
>>>> 
>>>> OAuth2 is working for me with other services - e.g. Slack.
>>>> 
>>>> client_id and client_secret contain only a-z, 0-9, full stop and hyphen - nothing that might want to be encoded.
>>>> 
>>>> Redirect ID is registered both with and without a slash, because I've been caught that way before.
>>>> 
>>>> (My old code had an API Key, but the OAuth2 command doesn't take this as a param, so I don't think that's relevant at this point.)
>>>> 
>>>> Is anyone currently using the Google APIs successfully? Has anyone been through this before?
>>>> 
>>>> Any help gratefully received,
>>>> 
>>>> Ben
>>>> 
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list