K
Kinde8mo ago
hexwit

How to organise API Tests with REST and Kinde?

I have a restful api that I'd like protect with help of Kinde. How it is supposed to do an api testing that is protected by Kinde? (integrational testing) That should be disposable real accounts, or how? thanks. Stack: spring framework
1 Reply
CB_Kinde
CB_Kinde8mo ago
Try these steps: 1: Set Up a Test Environment: It's recommended to perform testing in a non-production environment to avoid any impact on your live data or services. 2: Register Your API with Kinde: Before you can protect your API with Kinde, you need to register it. This involves specifying your API endpoints and configuring them to require authentication. 3: Create Test Accounts: If you want, for integration testing, you can create disposable / real accounts in Kinde. These accounts should be used solely for testing purposes. Ensure that these test accounts have the appropriate permissions and roles to access the API endpoints you are testing. 4: Obtain Access Tokens: Since your API is protected, you'll need to authenticate your test requests. This typically involves obtaining an access token from Kinde, which you then include in the HTTP headers of your API requests. You can use the Kinde Management API to programmatically obtain tokens for your test accounts. 5: Perform API Calls: With the access token, you can make authenticated requests to your API. Use tools like Postman or write automated scripts to test various API endpoints. Check for both successful responses and proper handling of unauthorized access attempts. 6: Validate Responses: Ensure that the API returns the correct data and HTTP status codes in response to your requests. This includes testing for successful access with valid tokens and verifying that access is denied when expected (e.g., with expired or invalid tokens). 7: Clean Up: After testing, ask us to delete your testing accounts, unless you plan to reuse them. By following these steps, you can effectively perform integration testing on your API protected by Kinde, ensuring that it behaves as expected under various access scenarios. Docs: https://kinde.com/docs/build/register-an-api/ https://kinde.com/docs/build/test-the-connection-to-kindes-api/ Hope this helps. Let me know.
Kinde Docs
Register and manage APIs - Build on Kinde - Help center
Our developer tools provide everything you need to get started with Kinde.
Kinde Docs
Test the connection to Kinde’s API - Build on Kinde - Help center
Our developer tools provide everything you need to get started with Kinde.
Want results from more Discord servers?
Add your server