auth0-vue icon indicating copy to clipboard operation
auth0-vue copied to clipboard

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

Open Fukao0129 opened this issue 1 year ago • 0 comments

Checklist

  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

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.

Fukao0129 avatar Sep 04 '24 05:09 Fukao0129