On-boarding step after social login

Hey! I m using google social signin and i give new users the 'pedning' role attribute in my database, I want to redirect these type of users to the onboarding page whenever they try to access anything in my app. where i collect additional infos about them such as to setup a displayname. , so basically not allowed to skip this step, then i change their status to something like 'member'. i want to know if there is a way to get the authenticated user data in my middleware so i can read their role status and redirect accordinly isntead of spamming all my pages with this check ? or any other method. thank you !
2 Replies
kaas
kaas2mo ago
While this might not be the best way, we check in the middleware 1. Does a session exist? 2. Is the session "onboarded". its a value we put onto the session. Its either 0/1.. If its 0, the user is sent to onboarding. If its 1, the check stops there Its probably not the most effecient way ,however, we have around 1000 active users on at a time and it works
darc
darcOP2mo ago
thanks It worked perfectly

Did you find this page helpful?