Set custom cookie in Actions

Hey, in Login Flow Action, is it possible to set custom cookie?

So far, I can think of redirecting user to some endpoint in my app. This redirect would include Set-Cookie header. Then, my app would immediately redirect back to auth0 login flow. This way we can set a cookie for a user.

But there is extra redirect which needs to be done. This will cause troubles for silent authentication, because redirect is not possible there.

Followup question: What about deleting this cookie on logout? We could use redirect URL to redirect user to my app, which handles deleting cookie. Downside of this is that all apps should use the same logout URL. Isn’t there any Logout flow action?

Thanks!
Dom

Hi @jasekdominik34,

Welcome to the Auth0 Community!

Unfortunately, it is not possible to set a custom cookie in Actions. Instead, we recommend using the state to redirect users after login. You can find more information in this reference post.

Check out our documentation on using state to redirect users after login.

Yes, you can clear the session cookie by sending the user to the logout endpoint. Refer to the following FAQ for details: Clear Auth0 session cookie inside Action

Feel free to reach out if you have any further questions.

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.