Overwrite the AccessToken in the Xano Plugin?

Hello,
I want to implement a token refresh/rotation and I was wondering if the Weweb team can allow us to overwrite/update the AccessToken generated by the Xano plugin? This way, I won’t need to rely on REST API as an alternate measure to keep users logged in which would create complication because I’d have to keep both the native Xano plugin object/flow and whatever REST API flow I am using to check & refresh the token.

Thank!

I think a new feature is going to be dropped next week which will enable a Weweb action to set a new authToken. (You may want to wait to see if that is true.)

Alternatively, I’ve been using similar Javascript to others to achieve it.

Have your action that is returning the refreshed authToken, and then in a JS action use the code below (replacing the relevant variable id and workflow action id)

image

variables[/* xanoAuth accessToken */ 'f5856798-....-d43d771c64e1-accessToken'] = context.workflow['de4e6a75-.......-5bb03a80ec37'].result?.['data']['authToken']

window.vm.config.globalProperties.$cookie.setCookie("ww-auth-access-token", context.workflow['de4e6a75-.......-5bb03a80ec37'].result?.['data']['authToken']);
2 Likes

Thanks a lot, It seems that the solution you proposed is the idea one unless the update provides us with more flexibility. Thanks!

Hi, please do not override the cookie yourself.

As @MichaelLovell said we will release a new action. But for now you can do this instead =>

wwLib.wwPlugins.xanoAuth.storeToken(yourAccessToken)
2 Likes

Much appreciated!