# What's the difference between \`oauth2-token-exchange\`, \`oauth2-access-token\` and \`oauth2-refresh-token\`

**URL:** <https://community.auth0.com/t/whats-the-difference-between-oauth2-token-exchange-oauth2-access-token-and-oauth2-refresh-token/117398>\
**Category:** Get Help\
**Tags:** oauth-2-0, protocols\
**Created:** [September 29, 2023, 8:58am UTC](https://community.auth0.com/t/whats-the-difference-between-oauth2-token-exchange-oauth2-access-token-and-oauth2-refresh-token/117398 "2023-09-29T08:58:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will956](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/will956/32/42310_2.png) [@Will956](https://community.auth0.com/u/Will956)\
**Post date:** [September 29, 2023, 8:58am UTC](https://community.auth0.com/t/whats-the-difference-between-oauth2-token-exchange-oauth2-access-token-and-oauth2-refresh-token/117398/1 "2023-09-29T08:58:34Z")

</div>

Hello 👋

I’m looking at the authentication protocol object from the post-login action and I’m wondering what is the difference between those 3 values:

- oauth2-refresh-token
- oauth2-access-token
- oauth2-token-exchange

It is documented here [Actions Triggers: post-login - Event Object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object) but I’m not sure what is the real difference:

> - `oauth2-access-token` Refreshing a token using the refresh token exchange.
> - `oauth2-refresh-token` Refreshing a token using the refresh token exchange.
> - `oauth2-token-exchange`

I’m filtering the `oauth2-refresh-token` protocol to not trigger MFA in this action when refreshing the access token but I’m wondering if I should also use `oauth2-access-token` as well?

Can you clarify what is the difference between them?

Thanks 🙏

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 29, 2023, 5:14pm UTC](https://community.auth0.com/t/whats-the-difference-between-oauth2-token-exchange-oauth2-access-token-and-oauth2-refresh-token/117398/3 "2023-09-29T17:14:24Z")

</div>

Hi @Will956,

Thanks for posting your question on Community!

- `oauth2-refresh-token`: Refers to refreshing a token using the refresh token exchange.
- `oauth2-access-token`: Corresponds to the legacy POST `/oauth/accesstoken` request for an access token.
- `oauth2-token-exchange`: Refers to exchanging a code for an access token.

If you need to prevent MFA from being triggered for the `oauth2-refresh-token` transaction, you could do something like the following:

```auto
exports.onExecutePostLogin = async (event, api) => {
  if (event.transaction.protocol !== “oauth2-refresh-token”){
    api.multifactor.enable(‘any’)
  }
 //else do not trigger MFA
};

```

Finally, one thing to note is that you will need to set your _Require Multi-factor Auth_ to **Never** for this to work properly. This is because Actions will override the MFA setting being turned off.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/d/4/d4064bf2d4d6ea4ba11cd5f25f812c2f6486fbec.png)

Please let me know how this goes for you.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 13, 2023, 5:15pm UTC](https://community.auth0.com/t/whats-the-difference-between-oauth2-token-exchange-oauth2-access-token-and-oauth2-refresh-token/117398/4 "2023-10-13T17:15:03Z")

</div>

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