Welcome to the Kinde community.

P
K
A
A
A
Members
Ricer
R
Ricer
Offline, last seen yesterday
Joined September 23, 2024
Hi,

I'm trying to integrate the SDK into my web application. My backend is written in ExpressJS and my frontend in AngularJS.
The authentication flow is as follows:
1) User presses a button to Sign in with Kinde.
2) The user is navigated to the backend via window.location.href = this.api.address + 'kinde/login'
3) A check is made to see if user is authenticated (via await kindeClient.isAuthenticated(req))
4) If not authenticated, the user is redirected to BACKEND_URL/login via res.redirect('/login')
5) The user then enters the credentials and is redirected back to BACKEND_URL/login

This is the case if I enter from BACKEND_URL/login manually, but when I start from the frontend, after entering my credentials in Kinde, I get redirected to the unAuthorisedUrl
6 comments
R
I
I want to integrate a username+password along with google SSO in my web application.
My frontend is built using AngularJS
My backend is built using ExpressJS
I also store my data in MongoDB
I have a custom login page, in which I can either let the user connect via their username & password or they can Continue with Google.

Here's additional info regarding my app:
There are 3 user roles - admin, roleA, roleB
roleA can create roleB users, meaning they can create a username/password for them to login with
Only admin can create roleA users
There shouldn't be a sign up/register options, so a user (roleA or roleB) can only sign/log in if they have a username & password (or later with Google SSO)

Currently:
1) When a user logs in via their username & password, a JWT token is generated and stored in their user document in the database.
2) The backend responds with the user role + token which is stored in the localStorage in the Frontend.
3) Every request from the frontend contains the token in the headers (as bearer) and the backend verifies it using a middleware.

How do I migrate this process to Kinde? I tried asking KindeAI, but it confused me a bit

Couple of questions:
1) Do I need to add an application for both the Backend and Frontend? If so, which "technology" do I use for the Frontend application?
2) Since I have a custom login page, and I want my backend to handle requests. Is there anything special I need to do in the frontend with regards to Kinde SDK/API calls?
3) How do I setup Kinde in my backend if I have my main entry point app.js call a function in another script (routers/index.js) to initialize (app.use) all endpoints?
4) What do I need to do for a user to be able to login? The flow is: User logs in via frontend -> frontend sends request to BACKEND_URL/login with username + password -> ?
4 comments
D
R
P
Currently the endpoint only supports "email" and "username"
3 comments
A
R