[Solved] Google oAuth using Web API

Hi all,

I am currently working toward connecting a Google Sheet using the Web API component. I haven’t finished yet, but I did successfully get the token.

https://x.thunkable.com/copy/f5a3f633ceeb93af16a21e44a67c1f77

(You’ll have to supply the RefreshToken, ClientID, and ClientSecret.)

I hope this helps someone! (@samclever ?)
Brian

1 Like

Ahhhh… I have created 3 different credentials in the Google API dashboard, but I can’t seem to authorise.

No matter which credentials I use, I get error 401. The JSON result is:
{ "error" : "invalid_client", "error_description" : "Unauthorized" }

Any suggestions?
https://x.thunkable.com/projects/5dd4deea2acb250a941b289b/9f0a6441-92b5-4782-b7f8-7535fbe9417d/designer
(forgive its ugliness)

@cttricks has done quite a bit with Google Sheets, perhaps he can give us a few pointers?

1 Like

Thanks @domhnallohanlon,

Using the project above (with no modifications) I finally was successful in retrieving a Google Sheet using the suggestions in this StackOverflow post

Next step… appending a row!

1 Like

Sweet, thanks for the update Brian.

Ok to mark this question as Solved so?

1 Like

Yes, you can mark it as solved, but I didn’t really have a question. I just wanted to make this available to the community.

Btw… I successfully appended a row of data to a Google Sheet! Once I have it a little more fine-tuned, I’ll share an updated project here.

2 Likes

I had it working beautifully, but once again my project has been corrupted and now is unusable. Copies are unusable. I can’t copy blocks from one sheet to another within the same project. This is about the 10th time this has happened. Every time I start making significant process, the project is mysteriously corrupted and recovery is impossible.


(In this screenshot, I deleted the text which was initializing variable ‘Sheet ID’ resulting in the two errors and an unusable project.)

I first tried Thunkable in late 2015 and I recently came back to see how the product has matured, but I think I’ll wait at least another year or two, unless I can help the project by working on the code.

I’ll wait patiently and come back when:

  1. projects aren’t being corrupted after trivial changes
  2. there is a mechanism to easily import blocks and screens from one existing project to another existing project. (backpack, import, merge, whatever)
  3. The version of Thunkable Live available to everyone in the world is the latest version. (Although the current version is 120, many of us can only get v56 which is 11 months old.)

Brian

@domhnallohanlon, @joannietw, @jane

Is there any way to recover from these “internal error” messages? Or are my projects permanently borked? I can’t keep spending 50 hours on projects only to have them become unusable for no apparent reason.

I would love to contribute to the community, but right now I feel like the time I am spending here is a waste of my life since neither I nor anyone else can benefit from reusing my blocks.

Obrigado!
Brian

Fyi… I deleted and rebuilt the offending screen. (Fortunately, I was able to get screenshots of all the blocks.)

However, it was when I added [break out of loop] back into a function that it crashed again. This time, I was able to delete that command and refresh the screen and it seems like it’s okay.

So there may be a bug with exiting loops.

Here is the working project…

https://x.thunkable.com/copy/8f9209b8af7ecad132a27d0eb4253bc3

To use it you will need to go to https://console.developers.google.com/apis/credentials and create both an API key and a OAuth 2.0 client ID which is authorized for a web application. You’ll also need a spreadsheet ID and a sheet name (the default is “Sheet1”).

To be honest, I don’t remember which steps were important versus those which led me in the wrong direction since there is more bad advice out there than good advice.

If anyone out there wants to figure out the minimum number of steps and create documentation, I’m sure a lot of people would appreciate it.

1 Like