# \[Solved\] Google oAuth using Web API

**URL:** <https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756>\
**Category:** Questions about Thunkable X\
**Tags:** oauth, solved, webapi\
**Created:** [November 19, 2019, 2:14pm UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756 "2019-11-19T14:14:59Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![b.perkins](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/b.perkins/32/50493_2.png) [@b.perkins](https://community.thunkable.com/u/b.perkins)\
**Post date:** [November 19, 2019, 2:14pm UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/1 "2019-11-19T14:14:59Z")

</div>

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](https://x.thunkable.com/copy/f5a3f633ceeb93af16a21e44a67c1f77)

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

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

---

<div class="post-metadata">

**Author:** ![b.perkins](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/b.perkins/32/50493_2.png) [@b.perkins](https://community.thunkable.com/u/b.perkins)\
**Post date:** [November 20, 2019, 6:48am UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/2 "2019-11-20T06:48:28Z")

</div>

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](https://x.thunkable.com/projects/5dd4deea2acb250a941b289b/9f0a6441-92b5-4782-b7f8-7535fbe9417d/designer)  
(forgive its ugliness)

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [November 20, 2019, 9:41am UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/3 "2019-11-20T09:41:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![b.perkins](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/b.perkins/32/50493_2.png) [@b.perkins](https://community.thunkable.com/u/b.perkins)\
**Post date:** [November 20, 2019, 11:05am UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/4 "2019-11-20T11:05:59Z")

</div>

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

> <https://stackoverflow.com/questions/13871982/unable-to-refresh-access-token-response-is-unauthorized-client/41556775#41556775>

Next step… appending a row!

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [November 20, 2019, 12:19pm UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/5 "2019-11-20T12:19:51Z")

</div>

Sweet, thanks for the update Brian.

Ok to mark this question as Solved so?

---

<div class="post-metadata">

**Author:** ![b.perkins](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/b.perkins/32/50493_2.png) [@b.perkins](https://community.thunkable.com/u/b.perkins)\
**Post date:** [November 20, 2019, 6:02pm UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/6 "2019-11-20T18:02:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![b.perkins](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/b.perkins/32/50493_2.png) [@b.perkins](https://community.thunkable.com/u/b.perkins)\
**Post date:** [November 23, 2019, 8:00am UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/7 "2019-11-23T08:00:03Z")

</div>

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.

 ![55](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/6/06732622ce434ebc33dc81829bbd1e6c5f4f0e04.png)  
(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

---

<div class="post-metadata">

**Author:** ![b.perkins](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/b.perkins/32/50493_2.png) [@b.perkins](https://community.thunkable.com/u/b.perkins)\
**Post date:** [November 24, 2019, 7:41am UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/8 "2019-11-24T07:41:34Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![b.perkins](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/b.perkins/32/50493_2.png) [@b.perkins](https://community.thunkable.com/u/b.perkins)\
**Post date:** [November 25, 2019, 10:49am UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/9 "2019-11-25T10:49:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![b.perkins](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/b.perkins/32/50493_2.png) [@b.perkins](https://community.thunkable.com/u/b.perkins)\
**Post date:** [November 25, 2019, 1:18pm UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/10 "2019-11-25T13:18:45Z")

</div>

Here is the working project…

[https://x.thunkable.com/copy/8f9209b8af7ecad132a27d0eb4253bc3](https://x.thunkable.com/copy/8f9209b8af7ecad132a27d0eb4253bc3)

To use it you will need to go to [https://console.developers.google.com/apis/credentials](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.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [July 16, 2021, 9:13pm UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/11 "2021-07-16T21:13:13Z")

</div>

really solid here!

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [December 16, 2021, 9:17pm UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/12 "2021-12-16T21:17:27Z")

</div>

Here’s a fun example of integrating Oauth with our apps here! This uses firebase as a backend to handle background management. Free to run. Not no code but only about 100-150 lines of code max. MAX.

[https://x.thunkable.com/projectPage/619eee4648281c0011b2d5bd](https://x.thunkable.com/projectPage/619eee4648281c0011b2d5bd)

This means it’s not a standalone app. That said, most apps arent standalone and have some kind of backend service/server. In this case, it’s a backend server.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:42am UTC](https://community.thunkable.com/t/solved-google-oauth-using-web-api/327756/13 "2024-11-08T11:42:56Z")

</div>


