---
title: Creating Custom OAuth Button
slug: creating-custom-oauth-button
docTags: 
createdAt: 2022-07-28T11:22:11.000Z
---

*Note: The following steps are for apps built on code-based platforms. If you are using no-code platform like Bubble, visit the&#x20;*[documentation here](https://docs.pathfix.com/bubble/custom-oauth-button)*&#x20;instead.*



Design your own HTML snippet

**Steps breakdown**

1. Include the helper tag by injecting the script element
2. Add the html connect block with necessary attributes
3. Show state of html block as connected or not&#x20;
4. Show disconnect button

## Step 1: Include helper script&#x20;

The Script tag is the primary include that loads all the libraries based on what is needed. In this case you only need it to load the pinc.oauth.min library

```html

<script src="https://labs.pathfix.com/helper.js" 
    id="pinc.helper" 
    modules="pinc.oauth.min" 
    data-user-id="[END USER ID]" 
    data-public-key="[PATHFIX PUBLIC KEY]" ></script>

```

**Replacements**

| Replacement        | Description                                                                                                 |
| ------------------ | ----------------------------------------------------------------------------------------------------------- |
| PATHFIX PUBLIC KEY | The Public key for your Pathfix Application. See [Pathfix keys](docId\:i5bP9DypNtQUAKv2r8Mbh) to learn more |
| END USER ID        | The Identifier used by your app to identify the logged in user (a unique ID you associate your user with)   |
|                    |                                                                                                             |



## Step 2: Add HTML Connect block

Add the following HTML block to your page. You can customize the html in any manner you want. Just ensure that the attributes are included as specified.

```html

<button 
    data-oauth-command="[PROVIDER NAME].call" 
    data-client-id="[PATHFIX PUBLIC KEY]" 
    data-oauth-user-id="[END USER ID]" 
    data-oauth-consent-mode="popup" >Connect</button>

```

**Replacements**

| Replacement        | Description                                                                                                                      |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| PATHFIX PUBLIC KEY | The Public key for you Pathfix Application. See [Pathfix keys](docId\:i5bP9DypNtQUAKv2r8Mbh) to learn more                       |
| END USER ID        | The Identifier used by your app to identify the logged in user. (a unique ID you associate your user with)                       |
| PROVIDER NAME      | The internal provider reference for your added integration. See [Provider reference](docId\:Z26CDo6omB40W2fyMu_UT) to learn more |



## Step 3: Change Connected State

There are two ways to do this.&#x20;

1. (Recommended) Make an API Call (Proxied by your server) to the provider and check the response for errors
2. Make a call to the  [User Connection ](docId\:LvvpBho79yMzZhjTfPGha) API(Proxied by your server) to check whether the User is Authorized.&#x20;



## Step 4: Offer Disconnect

Offer your users the ability to disconnect or revoke their authorization. Call the Revoke Connection API (Proxied by your server) available on the [User Connection ](docId\:LvvpBho79yMzZhjTfPGha) page under the Revoke User Connection section.


:::hint{type="warning"}
**Proxy API's through your Server**

****
All API calls either to the **Provider&#x20;**&#x6F;r **Pathfix API&#x20;**&#x73;hould be proxied by your server as they will include the Private Key.&#x20;
:::

