K
Kinde7mo ago
Kelanp

Need help integrating with php

Hi, I'm new to auth services, pardon my silly questions. I'm have a php app and I've integrated the kinde sdk. I'm able to collect the access token after successful auth. My question is what should I do from here? My understanding is I need to collect user information(ID and email), save them along with the access token in my database and create a session in my app for the user. 1. Does it makes sense? Am I getting the typical flow right? 2. When calling the getUserDetails() function, it returns an empty array, not sure why. 3. Am I missing a step like sending back the access token to Kinde to collect user info for example? Any direction will be very helpful, I'd prefer relying on kinde instead of managing users myself in the app. Thanks
3 Replies
Oli - Kinde
Oli - Kinde7mo ago
Hi @Kelanp, Thanks for reaching out, and there is no such thing as a silly question. Your understanding of the typical flow is on the right track. After successfully authenticating a user and obtaining an access token, the next steps usually involve retrieving the user's information, saving that information along with the access token in your database, and creating a session for the user in your application. This process allows you to maintain a state of authentication for the user as they navigate through your application. Regarding your issue with the getUserDetails() function returning an empty array, there are a few things to consider: 1. Ensure Authentication: Before calling getUserDetails(), make sure that the user is authenticated and that you have a valid access token. The access token is necessary to retrieve user details. 2. Check Token Scope: Ensure that the access token you have has the appropriate scopes to access user information. If the token's scopes are too limited, it might not allow for retrieving user details. 3. Verify SDK Configuration: Double-check your Kinde SDK configuration to ensure it's set up correctly. This includes verifying the KINDE_HOST, KINDE_CLIENT_ID, and other relevant configuration settings as mentioned in the PHP SDK documentation. 4. Session Management: After retrieving the user's details, you can proceed to create a session in your application. This typically involves setting a session cookie or using another method to maintain the user's logged-in state. If you're still encountering issues with getUserDetails() returning an empty array, it might be helpful to review any error messages or logs that could indicate what's going wrong. Additionally, ensure that your application's backend is correctly configured to communicate with Kinde's services. Please let me know if you are still experiencing any issues.
Kelanp
Kelanp7mo ago
Thanks a lot Oli, I've checked all the possible causes and I think the issue has to do with the way my app is set up. I'm using a php framework, I'll dig into it to find the cause. Thanks again.
Oli - Kinde
Oli - Kinde7mo ago
More than happy to help you further after you dig a little deeper. Just reach out here!
Want results from more Discord servers?
Add your server