Hi @Brandon_Cannaday coming back to this a while later, is there a easier/more dynamic way to allow the login to redirect to any page after login in completion with out having to put the
redirect path explicitly in each pages redirect path.
Id like it to work out right to any page, after you long in, but having to remember to put the redirect in each new pages sounds like an easy way to have mistakes.
Experiences do support version-wide unauthorized handlers:
You can find this by clicking the Edit main navigation menu â the three dots in the top-right corner â Version Settings.
You can provide a template there that sends the user to /login and appends the userâs current page and query parameters to a redirect parameter.
The template is:
/login?redirect={{encodeURIComponent request.path}}%3F{{encodeURIComponent (queryStringEncode request.query)}}
Then, you can configure each endpoint to use the Versionâs default âUnauthorizedâ reply:
To summarize:
- Configure the default unauthorized behavior that can be applied to every endpoint in your experience.
- Update all existing endpoints to use the new default behavior.
- All new endpoints automatically use the version default, so youâll never have to remember to add this behavior in the future.
Great! I will have to manually set each endpoints redirect to use default? is there a way to make sure this is always the default for new endpoints
Youâll have to update your existing endpoints. Thereâs nothing you have to do for new endpoints. Using the version-wide unauthorized handler is the default setting for new endpoints.
Probably spent more time building this trying to figure out how to escape {{ }} in a string than it wouldâve took to do it manually but, I was able to mass update every endpoint via this setup using the API node.
Then loop over the resulting endpoints using their id
and use this json as the patch
{
"unauthorizedReply": {
"type": "redirect",
"value": "/login?redirect=\u007B\u007BencodeURIComponent request.path\u007D\u007D%3F\u007B\u007BencodeURIComponent (queryStringEncode request.query)\u007D\u007D"
}
}
To escape curly braces in templates, you use a leading backslash:
{
"path": "/devices/\{{hello}}"
}
However, what youâre doing is updating every endpoint to have its own redirect configuration. If you want to use the version default, you need instead set unauthorizedReply to null:
{
"unauthorizedReply": null
}
That will remove the endpoint-specific behavior, which causes it to fall back to the version default behavior.