# How do you redirect someone after logging in?

**URL:** <https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689>\
**Category:** How do I?\
**Created:** [October 2, 2024, 2:18pm UTC](https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689 "2024-10-02T14:18:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://community.weweb.io/u/Matthew)\
**Post date:** [October 2, 2024, 2:18pm UTC](https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689/1 "2024-10-02T14:18:08Z")

</div>

I’m using Supabase Auth. When unauthenticated users try to access a page that requires log-in, the Supabase auth plugin redirects them to the sign in page.

How do I redirect them back to the page they came from after signing in? Any tips / demos?

---

<div class="post-metadata">

**Author:** ![Fix](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/fix/32/8212_2.png) [@Fix](https://community.weweb.io/u/Fix)\
**Post date:** [October 2, 2024, 2:24pm UTC](https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689/2 "2024-10-02T14:24:17Z")

</div>

Hi @Matthew ,

You can use the

> navigate to previous page

in the actions when you are in a WF

---

<div class="post-metadata">

**Author:** ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://community.weweb.io/u/Matthew)\
**Post date:** [October 2, 2024, 5:41pm UTC](https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689/3 "2024-10-02T17:41:20Z")

</div>

Thanks for the note! However, I tried that but it just takes everyone back to the home page instead of the last page. Any other ideas?

---

<div class="post-metadata">

**Author:** ![antoine\_caron](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@antoine\_caron](https://community.weweb.io/u/antoine_caron)\
**Post date:** [October 3, 2024, 8:57am UTC](https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689/4 "2024-10-03T08:57:02Z")

</div>

I am personally not using Supabase but i do the redirection in the workflow of the login form.

You have a video here on weweb/supabase auth:

[![](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/6606c8bdd88a05b57b2a9603faba05de2ac62cc0.jpeg "User authentication with Supabase") ](https://www.youtube.com/watch?v=pJgwMv-1dPs&t=180)

May be it can help you!

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [October 3, 2024, 9:06am UTC](https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689/5 "2024-10-03T09:06:19Z")

</div>

Usually you get a hint where you were redirected in the url as a hash, or a query parameter. Based on that you should be able to do whatever you need to do.

---

<div class="post-metadata">

**Author:** ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://community.weweb.io/u/Matthew)\
**Post date:** [October 7, 2024, 2:43pm UTC](https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689/6 "2024-10-07T14:43:20Z")

</div>

Thx all, however do you have this issue to? It seems the redirect works if they got redirected _from an action within the website_, but if it’s a redirect from a direct URL it does NOT properly redirect them.

For example:

1. User types in [www.example.com/authenticated-page](http://www.example.com/authenticated-page)
2. That redirects them to [www.example.com/login](http://www.example.com/login)
3. They login, and are NOT redirected back to /authenticated-page

Thoughts?

---

<div class="post-metadata">

**Author:** ![metalsteve81](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@metalsteve81](https://community.weweb.io/u/metalsteve81)\
**Post date:** [October 7, 2024, 8:50pm UTC](https://community.weweb.io/t/how-do-you-redirect-someone-after-logging-in/13689/7 "2024-10-07T20:50:31Z")

</div>

This is how I have mine set up. I have multiple roles people can login with. Each role goes to a different section of my app.

“standard-user”  
“company-user”  
“company-admin”

I use the true/false splits to ask which role the person is and direct them to the correct page.  
The role is fetched from the users profile that matches the ID of the auth id.

Does this make sense?

 ![signIn](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/1/14f04d5f4731685efc7bd9a2c8af08f996698b7e.png)

If you only have one login role just use a “navigate to” after the “sign in”
