Refresh user session after profile update

Hello,

My PHP project uses the following libraries and frameworks:

  • backend Laravel v10.45.1
  • frontend SSR with Laravel blade + livewire
  • auth0/auth0-php v8.11.1
  • auth0/login v7.12.0

In the Auth0 login flow, I add the app_metadata key/values to the tokens to be able to retrieve them through the auth()->user()->myCustomVar property.

A logged user in my app can trigger an update of a key/value in the app_metadata of his profile through the Auth0 management API, this is working fine.
But once the key/value has been updated in Auth0 backend, the new value is not available through the auth()->user()->myCustomVar property, as it is gathered only on login.

How can I refresh the tokens without triggering a logout+login ?

Thanks !

Hi @nico.mls,

Welcome to the Auth0 Community and thank you for posting this, but sorry for answering late.

In order to refresh your tokens without requiring users to go through a whole logout+login flow, you can Configure Silent Authentication, which renews the existing tokens as long as the user still has a valid session at Auth0.

This should solve your use case, but I hope it helps others as well.
Thanks,
Remus

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