Callback URL invalid

I'm trying to implement custom auth pages. In my Python I redirect to the auth endpoint with both the connection_id for email+code auth and the email as emailhinty Even though I have provided a callback url https://localhost:3000" for testing, i then keep getting an error. When I click on "Add callback to application now" it brings me to a page with url: https://myorg.kinde.com/admin/cx/:nav&m:applicationdetails:::submenu&s:details&id:?callback_url= where no application seems to be selected. why?
myorg
myorg
Enterprise level auth without the enterprise BS
14 Replies
Ages
Ages2w ago
Hi @saundersMcLane To resolve the issue with the callback URL in your Kinde application, please follow these steps: Verify Callback URL Configuration: - Log in to your Kinde dashboard. - Navigate to Settings > Applications. - Select the relevant application. - Click on View details. - In the Callback URLs section, ensure that the URL https://localhost:3000/ is correctly added to the Allowed callback URLs field. Add Dynamic Callback URL for Subdomains (if applicable): - If your application uses subdomains, you can add a dynamic callback URL to handle redirects appropriately. - In the Callback URLs section, add a dynamic URL in the format: https://{organization.handle}.yourdomain.com. - Replace {organization.handle} with your organization's handle and yourdomain.com with your primary domain. For example: https://red.everycolor.com. - This configuration allows users to be redirected to the correct subdomain after authentication. https://docs.kinde.com/build/domains/subdomains-for-callbacks Ensure Application Selection: - When adding a callback URL, ensure that the correct application is selected. If no application is selected, you may encounter issues. - After clicking on "Add callback to application now," verify that the application is listed in the URL. Save Changes: After making the necessary changes, click Save to apply the configurations. For more detailed information, refer to the Kinde documentation on callback URLs. https://docs.kinde.com/build/domains/subdomains-for-callbacks/ If you continue to experience issues, please provide more details about the error message or behavior you're encountering, and I'll be glad to assist further
Kinde docs
Org handles and dynamic callbacks for subdomains
Our developer tools provide everything you need to get started with Kinde.
Kinde docs
Org handles and dynamic callbacks for subdomains
Our developer tools provide everything you need to get started with Kinde.
saundersMcLane
saundersMcLaneOP2w ago
hey! the issue persists. its strange. the callbacks are correctly configured for my application. so i guess the problem is with how i initiate the login. as i said, im using a custom login form. my app is built with the reflex python framework. the part of the docs for custom pages states that i have to pass the connection_id and the login_hint. i also watched a video on custom pages (kinde channel on youtube) and the guy uses a loginlink component. i looked that one up in the kinde github and saw that one also has to pass the login redirect url and the org id. but uuugh... can you just provide me with a workning python snippet? or just the link i have to use (until now im using the /oauth2/auth endpoint and urlencode login_hint, connection_id, login_redirect_url and org_code) please dont point me to docs again. thdy dont help me here. this is my code so far: class LoginState(rx.State):
@rx.event def login(self, form_data: dict): email = form_data["email"]
connection_id = os.getenv("CONNECTION_ID")
data = { "connection_id": connection_id, "login_hint": email, "org_code": "org_b91ef01a26e", "post_login_redirect_url" : "http://localhost:3000/callback" }
print(data)
auth_endpoint = kinde_client.authorization_endpoint print(auth_endpoint) url = auth_endpoint + "?" + urllib.parse.urlencode(data) return rx.redirect(path=url, is_external=True)
Ages
Ages2w ago
Hi @saundersMcLane , I’m sorry to hear you’re still facing issues with your custom authentication pages. Let’s address your concerns : Ensure that kinde_client.authorization_endpoint is correctly set to the proper authorization endpoint URL provided by Kinde. Here's a refined version of your code:
import os import urllib.parse import kinde_client # Ensure this is correctly imported class LoginState(rx.State): @rx.event def login(self, form_data: dict): email = form_data["email"] connection_id = os.getenv("CONNECTION_ID") org_code = "org_b91ef01a26e" # Replace with your actual org code post_login_redirect_url = "http://localhost:3000/callback" # Replace with your actual redirect URL data = { "connection_id": connection_id, "login_hint": email, "org_code": org_code, "post_login_redirect_url": post_login_redirect_url } print(data) auth_endpoint = kinde_client.authorization_endpoint # Ensure this is correctly set print(auth_endpoint) url = auth_endpoint + "?" + urllib.parse.urlencode(data) return rx.redirect(path=url, is_external=True)
Key Points to Verify: - Ensure there are no extra spaces before or after the callback URL in your Kinde application. - The Client ID in your code must match exactly with the one in your Kinde application. - If you use wildcards in your callback URLs, ensure they are correctly configured. For example, https://*.mybusiness.com/callback is valid, but https://hello.*.com is not. If the issue still persists after these steps, please provide more details about the error message or behavior, and I’ll assist further. For a visual guide on custom sign-up and sign-in pages setup in Kinde, you might find this video helpful: https://youtu.be/63IT5qlXJ64 Let me know how it goes, and I’ll be happy to help further
Kinde
YouTube
Set custom sign-up and sign-in pages for your Kinde app
You can now customize your auth pages in Kinde! This is the first step towards complete headless authentication. You can now set completely customized flows for social sign-ins. Your users will only be redirected to a Kinde page when submitting passwords, or one-time codes. View the doc: https://kinde.com/docs/authentication-and-access/custom-a...
saundersMcLane
saundersMcLaneOP2w ago
i verified it all. doenst work. im gonna send you a video later.
Ages
Ages2w ago
Hi @saundersMcLane , Thank you for verifying the details and sharing your efforts. I’m sorry to hear the issue persists despite these steps. I appreciate your patience as we work through this together. If you could share a video of the issue, it would be incredibly helpful for troubleshooting. Please include any relevant logs or error messages as well, as this will help us identify the root cause more efficiently. In the meantime, I’ll continue exploring potential solutions and ensure we resolve this as quickly as possible.
saundersMcLane
saundersMcLaneOP7d ago
i sent it to you in a private chat as there appear names...
Ages
Ages7d ago
Hi @saundersMcLane Apologies for any inconvenience. To keep all the information consolidated, could you kindly resend the video along with any relevant logs or error messages here? This will help us streamline the process and address the issue more effectively. Thank you for your understanding and cooperation
saundersMcLane
saundersMcLaneOP7d ago
there it is
Ages
Ages7d ago
Hi @saundersMcLane , Thank you for providing the video. I’ll replicate the issue on my side and analyze it further. I’ll get back to you with an update as soon as possible. If you have any additional details or logs that could assist in troubleshooting, please feel free to share them here.
saundersMcLane
saundersMcLaneOP4d ago
thanks!!! any news @Ages ? my boss wants results haha i was like "ive already contacted their support team... otherwise ive tried everything i swear!" and he angrily replied "just get it done!" 😂
Ages
Ages4d ago
Hi @saundersMcLane , I understand the urgency of resolving this issue promptly. It seems you're encountering an 'Invalid callback URL' error during authentication. Could you please make sure: Verify Callback URL Configuration: - In the Allowed callback URLs section in your Kinde Dashboard, ensure that the URL your application redirects to after authentication is correctly added. For example, https://yourapp.com/auth/callback. Check for Trailing Spaces: - Ensure there are no spaces before or after the callback URL in your Kinde application settings. Match URLs Exactly: - The callback URL in your code must exactly match the callback URL in your Kinde application settings. Handle Dynamic Subdomains (if applicable): - If your application uses subdomains, you can add a dynamic callback URL to handle redirects appropriately. - In the Allowed callback URLs section, add a dynamic URL in the format: https://{organization.handle}.yourdomain.com. - Replace {organization.handle} with your organization's handle and yourdomain.com with your primary domain. For example: https://red.everycolor.com. Avoid Using Hash (#) in Callback URLs: - Some users have reported issues when using URLs with a hash (#) in the callback URL. It's recommended to avoid using hash routers unless absolutely necessary. https://community.kinde.com/kinde-returning-invalid-callback-url-even-though-the-url-is-in-our-allowed-list-mW1njDZc704h Ensure Application Selection: - When adding a callback URL, ensure that the correct application is selected. - For more detailed information, refer to the Kinde documentation on callback URLs. https://docs.kinde.com/get-started/connect/callback-urls If the issue persists after these steps, please provide any additional details or error messages, and I'll escalate this to our engineering team for further assistance
Kinde docs
Set callback and redirect URLs
Our developer tools provide everything you need to get started with Kinde.
saundersMcLane
saundersMcLaneOP3d ago
the docs again? please. 🥲 why dont you give me an exampe of what i have to send to the oauth endpoint? i have a feeling that the problem is with the request i make. and please no docs again. what the docs say wrt to custom auth pages is simply incomplete. i need a human answere here and no more pointing to docs. i have read them.
Yoshify
Yoshify3d ago
Hi @saundersMcLane, is there a reason you’re creating a URL and redirecting the way you are as opposed to using kinde_client.get_login_url()? You need to use the client login url function as it generates a URL using your environment information (which includes your callback URL) - you can still provide additional parameters to it like login_hint and org_code
saundersMcLane
saundersMcLaneOP9h ago
so i can pass login_hint and org_code and connection_id to get_login_url()? no that doesnt work. at this point i need to see a full python example? please lets cut this here and give me a working example. ive tried everything btw. the login url is the auth url with no path parameters like connection_id and so on update: solved the issue! i did it with the auth endpoint. it seems that responsetype was required as a path param and login_redirect_uri is just redirect_uri. now the whole flow works

Did you find this page helpful?