Next-Auth - Authenticating with provider without needing to press the button generated by next-auth.
Answered
Oak rough bulletgall wasp posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Oak rough bulletgall waspOP
I am using NextAuth with App router to Authenticate to my AzureAD B2C instance. I would like to bypass where the user has to press the "Sign in with Azure Active Directory" button (see screenshot) - I would instead just like to take the user straight to our B2C login page. Is this possible?
![Image](https://cdn.discordapp.com/attachments/1174524241375400046/1174524241538990110/image.png?ex=6567e7f0&is=655572f0&hm=482d7c5a959107bb74dba8eccfb8e54b995e923a867f9188f5fc68e8ae563384&)
Answered by Oak rough bulletgall wasp
I was able to do it using nextjs middleware and creating a custom signing page that forced the user to redirect.
4 Replies
![Avatar](https://cdn.discordapp.com/avatars/184479429404262410/a_35db4fb943e84d39bb02d6ec0f1d0b7e.gif?size=256)
DirtyCajunRice | AppDir
just pass the provider as a string to the login function. its clearly stated in the docs
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Oak rough bulletgall waspOP
Yeah I read that, however I was trying to redirect to it from a server component, I don’t think I can use signIn from a server component, right?
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Oak rough bulletgall waspOP
Additionally, I want to do this without the user having to click a button or anything. I solely want to redirect straight to my B2C sign in page if they have no session.
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Oak rough bulletgall waspOP
I was able to do it using nextjs middleware and creating a custom signing page that forced the user to redirect.
Answer