# Oauth Authentication (possibly with Pathfix?

**URL:** <https://community.glideapps.com/t/oauth-authentication-possibly-with-pathfix/66683>\
**Category:** Feature Requests\
**Tags:** api\
**Created:** [October 1, 2023, 12:20pm UTC](https://community.glideapps.com/t/oauth-authentication-possibly-with-pathfix/66683 "2023-10-01T12:20:50Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Rev](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Rev](https://community.glideapps.com/u/Rev)\
**Post date:** [October 17, 2023, 1:55am UTC](https://community.glideapps.com/t/oauth-authentication-possibly-with-pathfix/66683/6 "2023-10-17T01:55:49Z")

</div>

While I didn’t use Pathfix, I did manage to set up Oauth with Glide + Make.

**Use case:**  
Allow my users to connect their own HubSpot accounts to their profile in my Glide project. This allows each user to pull in data that’s relevant to their business (ie contacts, deals, etc). You could do this for any platform.

**High-level steps:**

1. Create a new Make scenario with the first module being a **Custom Webhook**.
2. Copy the webhook URL and use it as the **Redirect URL** in the platform you’re setting up OAuth in (HubSpot in this example). This will generate an Install URL.
3. Copy this Install URL into a **template column** in Glide and add `&state=@` to the end of it. Then, replace ‘@’ with the RowID. This will ensure you can link the Oauth back to your users/row in Glide.
4. Test the Install URL. It should send an **authorization code** to your Make scenario.
5. Connect a **HTTP (Make a Request)** module to the first module (Webhook).
6. In the **HTTP** module, send the authorization code received in the first module to the platform’s API and request the tokens. Refer to the platform’s API documentation for the specific API call.
7. Connect a **Data Store (Add/replace a record)** to the HTTP module. Set `state` as the key from the webhook and record the Refresh Token and Access Token.
8. Optional: You can then use a **HTTP** module to send these tokens back to Glide.

Oauth tokens only last around 30 minutes before they expire, so we need a way to refresh them:

1. Create a new Make scenario with a **Data Store (Search Records)** module as the first step. Configure it to use your data store and filter by `Refresh Token Exists`.
2. Connect an **Iterator** module if you have multiple tokens to refresh.
3. Connect a **HTTP** module and send the Refresh Token to the platform’s API to request new tokens. Refer to the platform’s API documentation for the specific API call.
4. Connect a **Data Store (Update a record)** module and set the key as the `state`. Map the HTTP’s output to update the relevant sections of your data store.
5. Set the first module to run every 29 minutes, daily, or whatever frequency you’d like. All done!

I’m sure there’s steps I’ve overcomplicated too. Would love to see how others refine this further!

---

_[View the full topic](https://community.glideapps.com/t/oauth-authentication-possibly-with-pathfix/66683)._
