Skip to content

Add onAutoRefreshSuccess or expose the JWT ? #185

@oom-

Description

@oom-

Add onAutoRefreshSuccess or expose the JWT

Problem

There is know way to know when the Access Token got refreshed.

I would like to trigger a function when the JWT get refreshed successfully.
But via the composable or the FusionAuthVuePlugin registration I do not have access to an event that is
triggered when the token is successfully refresh.

I can't watch the token change as well.

Solution

Call a callback that would be setup from the config like onRefreshFailed, could be called here:


this.config?.onRefreshSuccess(newToken);

I can create the instance myself by calling the createFusionAuth function:

fusionAuth = createFusionAuth(options);

But core is not exposed, (for possible wrap of core.refreshToken).
All is closed, would be great to have an event on access token refresh. that's all.

Alternatives/workarounds

if (cookieStore) {
    cookieStore.addEventListener("change", async (ev: CookieChangeEvent) => {
        for (const change of ev?.changed ?? []) {
            if (change.name == 'cookie_name') {
                //Do the boogie boogie
            }
        }
    });
}

Additional context

I would like to trigger an action + call on my JWT refresh in my app.

Community guidelines

All issues filed in this repository must abide by the FusionAuth community guidelines.

How to vote

Please give us a thumbs up or thumbs down as a reaction to help us prioritize this feature. Feel free to comment if you have a particular need or comment on how this feature should work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions