ZiriusPH
ZiriusPH
Explore posts from servers
BABetter Auth
Created by ZiriusPH on 2/25/2025 in #help
[Idea solicit] Pass authentication to another NextJS app after a logging in on a separate NextJS app
First, thank you very much for this powerful auth library! So we are building on a project where we are using AWS Cognito to store users and credentials. We have multiple NextJS application for each different role in our system, and another separate NextJS application whose only role is to serve the login page and authenticate the user. All are using latest NextJS 15 app router and is implementing SSR. Before we invest our time into building a AWS Cognito provider for Better Auth, we are wondering if the following use case is possible and if someone can suggest ideas on how to do them: 1. A user logins in our NextJS login page. AWS Cognito basically have only 1 option for us to control the flow which is the URL callback, the URL where the user will be redirected back along with their tokens. So in this scenario, the login page redirects the user to the AWS hosted login page and after they completed their authentication steps there they get back to the URL callback which would be the NextJS login app still. 2. Now, once we authenticated the user in the login app, we call the database to get their role. 3. Once we get their role, we should redirect them to the proper NextJS dashboard, i.e, teacher.my.app 4. It is important that the authentication along with the tokens are passed to the proper NextJS app, and that the authentication in the login page deleted since they would be working on their role dashboard henceforth. What we were thinking is that we save the tokens we received in the URL callback to the database and generate some hash for it. We use the same hash to compose a URL for that role dashboard, and once used those tokens will be assigned to the user as if they logged in the final dashboard in the first place. I am not just sure where can we do this "manually passing of auth tokens" using Better Auth, or if Better Auth suits our needs? I appreciate for any help or advise from anyone! Thank you!
22 replies
DTDrizzle Team
Created by ZiriusPH on 1/28/2024 in #help
[PostgreSQL] Option for Drizzle reuse my `public` schema for the migrations table?
No description
2 replies