# Editing user data (first/last name) in SPA forces re-login on refresh

**URL:** <https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033>\
**Category:** Get Help\
**Tags:** spa, user-profile, auth0\
**Created:** [April 14, 2020, 3:40pm UTC](https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033 "2020-04-14T15:40:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjaminwfox](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/benjaminwfox/32/13314_2.png) [@benjaminwfox](https://community.auth0.com/u/benjaminwfox)\
**Post date:** [April 14, 2020, 3:40pm UTC](https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033/1 "2020-04-14T15:40:37Z")

</div>

I have a SPA with some custom user-management (via the Auth0 management api) functionality.

The logged-in user (via Username-Password-Authentication connection) can edit their own first or last name (SPA makes calls to our API which updates Auth0).

This seems to work fine - after editing they can go about using the app as normal, token still valid, other API calls (where token is checked) all work fine.

However, if they refresh the page they are kicked out and have to login again (`auth0.checkSession` does not renew the session when the app loads). This happens regardless of whether or not the edited information (profile) has been included in the token scope.

I’m trying to figure out root cause, and if there is some way I can prevent this from happening. Any ideas what might be causing this or where to investigate further?

---

<div class="post-metadata">

**Author:** ![colin.coutts](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/colin.coutts/32/17217_2.png) [@colin.coutts](https://community.auth0.com/u/colin.coutts)\
**Post date:** [April 14, 2020, 10:47pm UTC](https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033/2 "2020-04-14T22:47:12Z")

</div>

Hi @benjaminwfox and welcome to the Auth0 Community!

Have you noticed any errors being returned by the `auth0.checkSession` when you’ve been debugging this either in the console or elsewhere? Additionally are there any logs that populate in the Auth0 Dashboard that are related to this event?

Best,  
Colin

---

<div class="post-metadata">

**Author:** ![benjaminwfox](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/benjaminwfox/32/13314_2.png) [@benjaminwfox](https://community.auth0.com/u/benjaminwfox)\
**Post date:** [April 15, 2020, 2:31pm UTC](https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033/3 "2020-04-15T14:31:53Z")

</div>

Hey Colin, thanks for reminding me that the logs exist 😄

It appears that updating the users name is also triggering the email to be updated (receiving `Success Change Email` event) even if the email remains unchanged. I suspect our API is sending the entire user payload with the `PATCH` operation, so will follow up with our team.

I also confirmed that updating the users name alone was not enough to force the user to re-login.

Hopefully that will solve the issue, will follow up on this issue once I confirm.

Thanks again for pointing me in the right direction!

---

<div class="post-metadata">

**Author:** ![benjaminwfox](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/benjaminwfox/32/13314_2.png) [@benjaminwfox](https://community.auth0.com/u/benjaminwfox)\
**Post date:** [April 15, 2020, 10:25pm UTC](https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033/4 "2020-04-15T22:25:50Z")

</div>

Followup with the eventual solution. There were indeed superfluous email-related fields being sent. These were `blocked`, `verify_email`, and `email_verified`.

With additional testing I found that if the `email_verified` attribute is present, regardless of whether or not the value has actually changed, it will trigger the “Success Change Email” event and require the user to log in again.

Thanks again!

---

<div class="post-metadata">

**Author:** ![colin.coutts](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/colin.coutts/32/17217_2.png) [@colin.coutts](https://community.auth0.com/u/colin.coutts)\
**Post date:** [April 15, 2020, 10:55pm UTC](https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033/5 "2020-04-15T22:55:31Z")

</div>

@benjaminwfox way to go with finding the root of that issue! I’m glad you’ve been able to get the correct user behavior moving forward.

Have a good one and thanks for choosing Auth0!

Best,  
Colin

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 16, 2020, 7:41am UTC](https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033/6 "2020-04-16T07:41:39Z")

</div>

Thanks @benjaminwfox for sharing the fix with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 23, 2020, 1:07pm UTC](https://community.auth0.com/t/editing-user-data-first-last-name-in-spa-forces-re-login-on-refresh/41033/7 "2020-04-23T13:07:33Z")

</div>


