# How to implement OAuth with glide app?

**URL:** <https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276>\
**Category:** Ask for Help\
**Created:** [September 18, 2023, 5:39pm UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276 "2023-09-18T17:39:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haris\_Abbasi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/haris_abbasi/32/64006_2.png) [@Haris\_Abbasi](https://community.glideapps.com/u/Haris_Abbasi)\
**Post date:** [September 18, 2023, 5:39pm UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276/1 "2023-09-18T17:39:40Z")

</div>

I am new to the glide app. I have written backend logic and endpoints to implement Oauth of 3rd party API. I have a button that will redirect the user to the OAuth login page and after successful login user will be redirected to the backend endpoint. After saving accessTokens of third-party API to the database via my backend server, I want to redirect to the glide app. Is this possible here?

---

<div class="post-metadata">

**Author:** ![epdarias](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/epdarias/32/45740_2.png) [@epdarias](https://community.glideapps.com/u/epdarias)\
**Post date:** [September 18, 2023, 6:58pm UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276/2 "2023-09-18T18:58:11Z")

</div>

Yes, it’s possible. I have an app that do it that exactly. I think that you only need to redirect your backend code to Glide App.  
In my case, I have as last step, after saving tokens, the next code in PHP:

```auto
// We redirect the user to the webapp page
echo "<script>window.location.replace('" . WEBAPP_URL . "');</script>";

```

If you need more code, I will be happy to provide it to you.

---

<div class="post-metadata">

**Author:** ![Haris\_Abbasi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/haris_abbasi/32/64006_2.png) [@Haris\_Abbasi](https://community.glideapps.com/u/Haris_Abbasi)\
**Post date:** [September 19, 2023, 5:26am UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276/3 "2023-09-19T05:26:09Z")

</div>

I’ve glide mobile app. Should i use deep link for that?.

---

<div class="post-metadata">

**Author:** ![epdarias](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/epdarias/32/45740_2.png) [@epdarias](https://community.glideapps.com/u/epdarias)\
**Post date:** [September 19, 2023, 6:55am UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276/4 "2023-09-19T06:55:46Z")

</div>

I haven’t tried that, but I think so. In my case, the redirect is to my PWA domain.  
Attached, I’m sending you a video where we have implemented a Google API OAuth with Glide so you can see that it does work.  
 ![AG1N0cRwctQg2eKulFJE](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/3/b3dfe7b7c54e83e27c4c2cf8b4fdb524409cafc1.gif)

---

<div class="post-metadata">

**Author:** ![Haris\_Abbasi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/haris_abbasi/32/64006_2.png) [@Haris\_Abbasi](https://community.glideapps.com/u/Haris_Abbasi)\
**Post date:** [September 19, 2023, 5:01pm UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276/5 "2023-09-19T17:01:08Z")

</div>

This is my app url: [https://tradepocketapp.glideapp.io](https://tradepocketapp.glideapp.io)  
How can I add functionality where I will attach accessToken and refreshToken to [https://tradepocketapp.glideapp.io](https://tradepocketapp.glideapp.io) URL. In my glide app side, I want to fetch these tokens to get third party data I saved in my database via backend server?.  
URLhttps://tradepocketapp.glideapp.io/thirdpartyplatform/accesstoken=accesstoken&refreshToken=refreshToken

---

<div class="post-metadata">

**Author:** ![Haris\_Abbasi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/haris_abbasi/32/64006_2.png) [@Haris\_Abbasi](https://community.glideapps.com/u/Haris_Abbasi)\
**Post date:** [September 21, 2023, 5:17am UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276/6 "2023-09-21T05:17:49Z")

</div>

@epdarias Can you guide me on above message please?

---

<div class="post-metadata">

**Author:** ![epdarias](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/epdarias/32/45740_2.png) [@epdarias](https://community.glideapps.com/u/epdarias)\
**Post date:** [September 21, 2023, 8:59am UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276/7 "2023-09-21T08:59:22Z")

</div>

Hi @Haris_Abbasi !  
In my case, I have a button to update my activity from Google Fit.

 ![Screenshot at Sep 21 09-51-54](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/6/b6f48554db388f6f93bb682eb43e8c0c4d3b29c2.png)

This button, insert a row in a Google Sheet with the necessary information (userID, accessToken, refreshToken…) to get data from Google Fit by access token.

 ![Screenshot at Sep 21 09-52-47](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/3/b35789ed8b3bcd56c082ca82233f555d2d47b30b.png)

In Google Sheet, I have a trigger “ON INSERTED” in order to read this new row.

 ![Screenshot at Sep 21 09-53-52](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/7/17e9a8fe8d350e4bf68c03f7a075504313c549b7.png)

My trigger check if access token is expired and I refresh it with the refresh token if is necessary.

 ![Screenshot at Sep 21 09-54-50](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/e/ce78fc5742e42c60ed9302df0186d75f4802b705.png)

This new access token is saved in Glide with a date time updated.  
 ![Screenshot at Sep 21 09-55-54](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/d/ad5b0c2f957b094ff4b681e0707180f7fd32535c.png)

And with this access token, I can get data from Google Fit and I update info in Glide.

I hope this can help you a little 👍🏻

---

<div class="post-metadata">

**Author:** ![epdarias](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/epdarias/32/45740_2.png) [@epdarias](https://community.glideapps.com/u/epdarias)\
**Post date:** [September 21, 2023, 11:30am UTC](https://community.glideapps.com/t/how-to-implement-oauth-with-glide-app/66276/8 "2023-09-21T11:30:15Z")

</div>

Sorry, I forgot to tell you that I use App Script in Google Sheet in order to create all necessary code.
