Authentication error
I set up a new Rails app using the ruby SDK and I'm getting
Authentication error
when trying to log in. I see that the user does get registered, but I can't log in for some reason. I get as far as entering confirmation code. I've triple checked my app config (which is more or less the default) and callback URLs and everything seems correct.7 Replies
Hi @bed sores,
Sorry to hear you are experiencing this issue.
Would you be willing to share a recording (or screenshot) of your issue? You can DM me this if you prefer.
Also, if you are willing to do so, would you be willing to download the Ruby starter kit and see if you are experiencing the same issue?
GitHub
GitHub - kinde-starter-kits/ruby-starter-kit: Get up and going with...
Get up and going with Kinde using Ruby. Contribute to kinde-starter-kits/ruby-starter-kit development by creating an account on GitHub.
@Oli - Kinde DM sent. i was basing mine off that starter kit example but will try and run it and let you know what happens.
i get a different error when running the starter kit:
{"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Redirect URL is using an insecure protocol, http is only allowed for hosts with suffix 'localhost', for example: http://myapp.localhost/."}
could be that, for some reason, it's just hiding the error in my setup? will try and use localhost and see if that fixes it
hm, nope. so just using localhost fixed the starter kit, but my app stil results in Authentication error
.
made a bit of progress, i think.
this is seemingly coming from KindeSdk.client(session[:kinde_auth]).oauth.get_user.to_hash
in the after login callback
Hey @bed sores,
Thanks for all of this information.
The
403 Forbidden
error you're encountering when trying to fetch user information using KindeSdk.client(session[:kinde_auth]).oauth.get_user.to_hash
suggests that there's an issue with the permissions or authentication of your request. This could be due to several reasons:
1. Invalid or Expired Access Token: Ensure that the access token you're using to make the request is valid and has not expired. The fetch_tokens
method should provide you with a valid access token, but it's worth verifying that this token is correctly stored in session[:kinde_auth]
and is being used properly in the request.
2. Insufficient Permissions: The access token must have the necessary permissions to access user information. Make sure that the scopes requested during the authentication process include permissions to access user profile data. By default, Kinde requests scopes like profile
, email
, offline
, and openid
. If you've customized the scopes, ensure that you're requesting the appropriate ones.
3. Configuration Issues: Double-check your Kinde SDK configuration to ensure that all required fields (such as domain
, client_id
, client_secret
, callback_url
, and logout_url
) are correctly set up. Misconfiguration in any of these could lead to authentication issues.
4. Session Management: Verify that the session management in your Rails application is working as expected. Issues with session persistence or incorrect session data could lead to authentication errors.
Given the code snippet you've shared, your implementation seems correct. However, you might want to add some error handling around the fetch_tokens
and get_user
calls to catch any issues and log them for further investigation.
Please let me know if you are still experiencing issues.yeah sorry, still having the same issue. :/ not sure what to do about #1 if that were the issue. for #2, i'm asking for the default
openid offline email profile
, haven't customized it. #3, double checked and i'm setting everything.
i'm def doing something wrong since the sdk example worked, i just don't know what
actually logging in works, it's the KindeSdk.client().oauth.get_user
that doesn'tHey @bed sores,
We had a few customers reporting 403 errors and we just deployed a fix. Are you able to try again and see if you are still experiencing 403 errors?
sweet, works now. thanks!
Awesome great to hear.
Please reach out if you come across any other issues.