# OAuth2 Custom App - Refresh Token Request Issue with Sub Parameter

**URL:** <https://community.make.com/t/oauth2-custom-app-refresh-token-request-issue-with-sub-parameter/70911>\
**Category:** Questions\
**Tags:** connections\
**Created:** [February 22, 2025, 1:13am UTC](https://community.make.com/t/oauth2-custom-app-refresh-token-request-issue-with-sub-parameter/70911 "2025-02-22T01:13:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![caner](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@caner](https://community.make.com/u/caner)\
**Post date:** [February 22, 2025, 1:13am UTC](https://community.make.com/t/oauth2-custom-app-refresh-token-request-issue-with-sub-parameter/70911/1 "2025-02-22T01:13:25Z")

</div>

Hi everyone,

I’m having an issue with my OAuth2 custom app implementation where the ‘sub’ parameter is being sent empty in the refresh token request. Here’s my setup:

1. Authentication Flow:

- Using OAuth2 with custom endpoints
- Successfully getting access\_token and user info
- Refresh token mechanism is implemented but not working as expected

1. Current Implementation:

```auto
{
    "authorize": {
        "url": "..../auth",
        "qs": {
            "source": "{{oauth.makeRedirectUri}}",
            "integration": "make"
        },
        "response": {
            "temp": {
                "access_token": "{{query.access_token}}",
                "refresh_token": "{{query.refresh_token}}",
                "id_token": "{{query.id_token}}"
            }
        }
    },
    "token": {
        "condition": "{{temp.access_token}}",
        "url": "...../auth/verify-token",
        "method": "POST",
        "body": {
            "access_token": "{{temp.access_token}}"
        },
        "type": "json",
        "response": {
            "data": {
                "expires": "{{addSeconds(now, 3600)}}",
                "accessToken": "{{temp.access_token}}",
                "refreshToken": "{{temp.refresh_token}}"
            },
            "expires": "{{addSeconds(now, 279200)}}"
        }
    },
    "info": {
        "url": "..../auth/verify-token",
        "headers": {
            "Authorization": "Bearer {{connection.accessToken}}"
        },
        "method": "POST",
        "type": "json",
        "body": {
            "access_token": "{{connection.accessToken}}"
        },
        "response": {
            "uid": "{{body.user_info.sub}}",
            "metadata": {
                "sub": "{{body.user_info.sub}}",
                "email": "{{body.user_info.email}}",
                "value": "{{body.user_info.email}}",
                "username": "{{body.user_info.username}}",
                "family_name": "{{body.user_info.family_name}}",
                "given_name": "{{body.user_info.family_name}}",
                "picture": "{{body.user_info.picture}}"
            }
        }
    },
    "refresh": {
        "condition": "{{data.expires < addMinutes(now, 1)}}",
        "url": "....../auth/refresh-token",
        "method": "POST",
        "body": {
            "sub": "{{data.uid}}",
            "refresh_token": "{{connection.refreshToken}}"
        },
        "type": "json",
        "response": {
            "data": {
                "expires": "{{addSeconds(now, body.expires_in)}}",
                "accessToken": "{{body.access_token}}",
                "idToken": "{{body.id_token}}"
            }
        }
    }
}

```

1. Issue:

- The verify-token endpoint successfully returns user information

- I can access email and other user info from the response because when I check connection, I can see my email.  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/b/9/b9ec49800a63d512b4ee1ad78d421d3b4dedcf17.png)

- However, when making the refresh token request, the ‘sub’ parameter is empty

- Getting 422 Unprocessable Entity error due to empty sub parameter

Any help or guidance would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/make/original/1X/9786f7887a39f4a0fef4d09346ab5b54ce20222b.svg) [@system](https://community.make.com/u/system)\
**Post date:** [March 24, 2025, 1:13am UTC](https://community.make.com/t/oauth2-custom-app-refresh-token-request-issue-with-sub-parameter/70911/2 "2025-03-24T01:13:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
