How to Get and Delete Users in Kinde Using a Backend Web Application (Next.js + Kinde Provider)
Hello guys. I built a NextJs app with a Kinde provider for an authentication. Now on Kinde I created an Application using Back-end web. I am implementing a functionality to delete user from Kinde, and how could I get user from here after creating a Back-end web application. Sources I get on Kinde is related to applications created with Machine-to-Machine. I need your support here.
5 Replies
Hi Isaac,
You can manage users in your Next.js backend by calling the Kinde Management API with an M2M token. Here’s a streamlined approach:
1. Create an M2M App
- In Kinde Dashboard → Settings → Applications, add a Machine-to-Machine app.
- Note its Client ID and Client Secret.
2. Grant the Right Scopes
- In that M2M app’s settings, enable the Management API and add
Let me know if you need sample code or run into any issues
users:read
and users:delete
scopes.
3. Get an M2M Token
4. List Users
5. Delete a User
Use these raw URLs in your Next.js API routes to fetch and delete users as needed.Let me know if you need sample code or run into any issues
Thank you very much. But my question was rather than creating an M2M application first, I did create a backend web application. So my list of users are inside the backend web application. How do I now fetch users? if it were an M2M application I would have done it in the way you stated above, but how about for this?

Hello, so you can’t use the NextJs SDK to retrieve and delete your users in kinde you have to go with M2M.
To make it easier Kinde have a package @kinde/management-api-js that helps you do that and much more
See here: https://docs.kinde.com/developer-tools/kinde-api/connect-to-kinde-api/
Kinde docs
Set up Kinde Management API access
Our developer tools provide everything you need to get started with Kinde.
Problem solved. Thank you very much! I just created M2M application and proceed with the api.
Hi Isaac,
Glad to hear the issue is resolved. If you need assistance with anything else, feel free to reach out.
Have a great day
Have a great day