auth0 / auth0-vue

Auth0 authentication SDK for Vue.js apps
Other
140 stars 27 forks source link

Switch the redirect URL based on the user's information. #418

Closed Fukao0129 closed 1 month ago

Fukao0129 commented 2 months ago

Checklist

Describe the problem you'd like to have solved

After a user logs in, the page specified in Callback URL is displayed. Then, a few seconds later, SDK redirects to / page. I know this is an expected behavior because I've checked this FAQ.

What I'd like to implement is switch the redirect URL based on the user's app_metadata.

For example, if the user has available: true in app_metadata, SKD redirects to /dashboard. If the user has available: false in app_metadata, SKD redirects to /sorry.

The redirect URL can be set in appState.target, but I understand this must be a literal value and cannot be dynamic.

Describe the ideal solution

We should make it possible to specify a conditional expression in appState.target to handle redirects more granularly. Or, please implement a solution enabling finer-grained control over redirects from the callback URL.

Alternatives and current workarounds

Not at all. If anyone has any ideas, please share with me.

I've tried to use a middleware, but it didn't work well.

Additional context

Since English is not my first language, I apologize in advance if there are any rude expressions. I would be most grateful if some supplies a solution.