# Change authentication request frequency

**URL:** <https://community.auth0.com/t/change-authentication-request-frequency/64193>\
**Category:** Get Help\
**Tags:** mfa\
**Created:** [June 9, 2021, 2:17pm UTC](https://community.auth0.com/t/change-authentication-request-frequency/64193 "2021-06-09T14:17:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aashish](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aashish/32/14581_2.png) [@aashish](https://community.auth0.com/u/aashish)\
**Post date:** [June 9, 2021, 2:17pm UTC](https://community.auth0.com/t/change-authentication-request-frequency/64193/1 "2021-06-09T14:17:25Z")

</div>

I have an application which uses Auth0 MFA. My code does an POST request to `/oauth/token` and if the response is an error stating mfa\_required i do a POST request to `/mfa/challenge` to get the otp over email ,In the UI user enters the otp received and logins.

This flow works fine. But every time i logout and login , the otp is required. I want to change the authentication frequency , and and expects Auth0 to remember me for certain time.  
Upon reading through the dosc i came arounf the topic Change authentication request frequency , implemented it using `allowRememberBrowser: true` , But it didn’t worked. Since i am not using the Auth0 flow . How can i implement this feature using the Auth0 api’s. Do i need to call any api so that the cookies are saved in my browser and the next time the authentication is skipped.  
Can you please guide me through this .

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 9, 2021, 5:58pm UTC](https://community.auth0.com/t/change-authentication-request-frequency/64193/3 "2021-06-09T17:58:18Z")

</div>

Hi @aashish,

Welcome to the Community!

Can you post the code to your rule so we can take a look?

---

<div class="post-metadata">

**Author:** ![aashish](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aashish/32/14581_2.png) [@aashish](https://community.auth0.com/u/aashish)\
**Post date:** [June 10, 2021, 4:23pm UTC](https://community.auth0.com/t/change-authentication-request-frequency/64193/4 "2021-06-10T16:23:07Z")

</div>

```auto
function (user, context, callback) {

  var CLIENTS_WITH_MFA = ['<<CODE>>'];
  
   if (context.protocol === 'oauth2-refresh-token'){
    return callback(null, user, context);
  }
  // run only for the specified applications
  // if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) {
    // uncomment the following if clause in case you want to request a second factor only from user's that have user_metadata.use_mfa === true
    if (user.user_metadata && user.user_metadata.use_mfa){
      context.multifactor = {
        provider: 'any',
        allowRememberBrowser: true
      };
     }
  //}

  callback(null, user, context);
}

```

---

<div class="post-metadata">

**Author:** ![aashish](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aashish/32/14581_2.png) [@aashish](https://community.auth0.com/u/aashish)\
**Post date:** [June 10, 2021, 4:24pm UTC](https://community.auth0.com/t/change-authentication-request-frequency/64193/5 "2021-06-10T16:24:16Z")

</div>

Wanted to know how can i skip auth , and allow Auth0 to remember my browser by using the Auth0 api’s

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 10, 2021, 5:43pm UTC](https://community.auth0.com/t/change-authentication-request-frequency/64193/6 "2021-06-10T17:43:41Z")

</div>

Is the `user.user_metadata.user_mfa` conditional being met?

Also, you should use `app_metadata` for this flag, as it is considered access information:

> **[Understand How Metadata Works in User Profiles](https://auth0.com/docs/manage-users/user-accounts/metadata)**
>
> Describes Auth0 user, application, and client metadata. Learn how you can use metadata to store information that does not originate from an identity provider.

> [@aashish](#):
>
> Wanted to know how can i skip auth , and allow Auth0 to remember my browser by using the Auth0 api’s

Using that flag should allow that to happen.

---

<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:** [July 13, 2021, 4:32pm UTC](https://community.auth0.com/t/change-authentication-request-frequency/64193/7 "2021-07-13T16:32:43Z")

</div>

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