Flutter auth, on iOS it is redirecting correctly to home page, but on Android it just loads forever
Login functionality is loading forever while on android, but on iOS it is correctly redirecting me to home page! I followed every single instruction on the docs but still getting this issue, Are there any specific code that should be added to AndroidManifest.xml or any other file to handle this? thanks in advance!
PS: while creating users it does the creation successfully on Android, which means the problem is within the callback url imo
10 Replies
Hi Fedy,
Thanks for sharing the issue. To help us understand the problem better, could you please clarify a few things?
1. Callback URL Configuration:
- Have you specified a callback URL specifically for Android within your configuration files (like
AndroidManifest.xml
)?
- Can you share the callback URL format you’re using?
2. Authentication Provider:
- Are you using a specific authentication service (like Firebase, Auth0, or a custom one)?
- If so, are there any platform-specific settings applied?
3. Console Logs:
- Are there any error messages or warnings in the Android Logcat when the redirect fails?
4. Package Configuration:
- Could you confirm if you have set the intent filter correctly in the AndroidManifest.xml
file?
5. Behavior Details:
- Does the login screen just keep spinning, or does it crash?
- Are you testing on a physical Android device or an emulator?
Your answers will help us pinpoint the issue more accurately. Looking forward to your response.1. Callback URL Configuration:
Yes I have specified a callback URL within my
AndroidManifest.xml
:
Snippet:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="com.kinde.myapp"
android:host="kinde_callback" />
</intent-filter>
2. Authentication Provider:
I am only using Kinde SDK for authentication (email + code)
3. Console Logs:
I tried debugging using HTTP Toolkit, here is what I got so far as a response:
STATUS:
302 Found
HEADERS
Connection:keep-alive
Content-Length:0
Content-Security-Policy:frame-ancestors 'none'
Date:Sun, 18 May 2025 14:11:42 GMT
Location:com.kinde.myapp://kinde_callback?code=lpAUWPbS5ySw79O90HJq0U3kPKTBFyzarQDEURRTZe4.KlnTJdJmFNuxPH6KN47sdOJN3UIKWvYcnhf6JpOJSjk&scope=email%20profile%20offline%20openid&state=xTFqU7Tczn4FQ6vTqRg07Q
Referrer-Policy:strict-origin-when-cross-origin
Set-Cookie:enduser_session_id=0x60350371af0e4ebd83b5c9e150c92447; Path=/; Domain=mindo.kinde.com; Expires=Mon, 19 May 2025 14:11:42 GMT; HttpOnly; Secure; SameSite=Lax
Vary:Origin
X-Frame-Options:deny
4. Package Configuration:
Here is my intent filter in the AndroidManifest.xml
:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="com.kinde.myapp"
android:host="kinde_callback" />
</intent-filter>
By the way my Kinde configuration callback url scheme is different from my app package name, is that okay?
5. Behavior Details:
The login screen keeps spinning forever without crashing or showing any errors on the screen, I have tested on both physical Android device and emulator! Same behavior detected on both!Hey Fedy,
Thanks again for all the details. It looks like Kinde is successfully redirecting to your app with the auth code (which is great), but it seems like the app isn't catching that redirect on Android, which is why the screen keeps spinning.
A few things to try/check:
---
1. Are you using something like
Once Android receives the intent, your app needs to listen for the incoming link and grab the code from it — that's what triggers the final step of the login. --- 2. Your manifest looks good, and it's actually okay if the callback scheme is different from your package name — what matters is that: - The scheme (
uni_links
or go_router
with a deep link listener in your app?Once Android receives the intent, your app needs to listen for the incoming link and grab the code from it — that's what triggers the final step of the login. --- 2. Your manifest looks good, and it's actually okay if the callback scheme is different from your package name — what matters is that: - The scheme (
com.kinde.myapp
) and host (kinde_callback
) match exactly in both:
- Kinde dashboard callback setting
- AndroidManifest.xml
- The URL listener inside your Flutter app
---
3. You might try printing/logging the initial URI your app receives from the deep link to see if it's being triggered at all. If it’s not, the intent filter or listener might not be wired up correctly.
---
If all of that looks correct and it’s still not working, let me know — I’ll escalate this to our engineering team so we can help investigate deeper.Hello, thanks again for your answer!
1. I am not using
uni_links
or go_router
with a deep link listener in my app, I have not included anything about deep linking at all!
2. Can you provide me more infos about the url listener inside my Flutter app? Do you mean the initialization of Kinde SDK inside my Flutter app?
3. This is what I get in my console after I try to login: W/AppAuth ( 4047): No stored state - unable to handle response
using correct credentials
Could you precise what do you exactly mean by the URI my app receives from the deep link?
I would love to get a few minutes assistance from the engineering team if possible! Thanks in advance!Hi Fedy,
Thanks for the detailed input. I’ll discuss this internally with our team and get back to you as soon as I have more insight or further steps to try. In the meantime, please feel free to reach out if you have any additional questions or updates.
Thank you so much, I really appreciate your help!
Hello, any news please? is it possible if I get assistance from the engineering team?
Hi Fedy,
I’ve forwarded your case and will follow up with our engineering team again on Monday. Please note that, due to high developer demand, their response may be delayed. Nonetheless, I’ll keep you updated and let you know as soon as I have any new information or assistance to share.
If you have any other questions in the meantime, please don’t hesitate to reach out.
Hello,
Thank you for the update, I really appreciate it. I just wanted to follow up as this is a client project, and I’m trying to ensure everything goes smoothly on my side.
Looking forward to hearing from the engineering team when there’s any progress. Thanks again for your support!
Hey Fedy,
I understand your urgency and I’ve already escalated this to our engineering team. I’ll share any updates from them as soon as I receive them. In the meantime, since you mentioned you’re not currently using any deep link handling, I recommend implementing a deep link listener in your Flutter app (using something like
uni_links
or flutter_web_auth_2
). This is typically required for the final step of authentication to complete correctly on Android, and it should resolve the issue where the app just keeps spinning after login.
Let me know if you have any questionsThank you so much for your time, waiting for your updates