Refresh token mechanism with Custom authentication

I am authenticating against an external system and getting back a token and a refresh token.

Does anybody know how to correctly implement the automatic refresh when the token is no longer valid?

At this point I have setup an action block on every page that handles this logic and this returns a boolean, but it doesn't feel right. First of all I cannot refresh the token from within that action block (the options to set the authenticated user token and refresh token are not accessible). So after every action block I need to put the logic to get the new token when it's not valid over and over again. This cannot be the right way so I am hoping the community can help me here :-)

11
15 replies