flutter_line_sdk icon indicating copy to clipboard operation
flutter_line_sdk copied to clipboard

Question: For native app login, how to properly setup the redirection to my app

Open GinoLin980 opened this issue 10 months ago • 14 comments

I have a Flutter native app, when running on emulators, they were fine as they used internal browser to login.

But when I test my app on my own Android phone, which has native LINE, to login, it logged in seccessfully and did not pop to my app, it just stay in LINE native app.

Is there any guide or instructions specifying on deeplinking or callback or something on solving this?

GinoLin980 avatar Feb 16 '25 06:02 GinoLin980

same question

yxwandroid avatar Feb 16 '25 08:02 yxwandroid

GinoLin980 avatar Feb 24 '25 14:02 GinoLin980

Hi @GinoLin980 , Thanks for your report. As I couldn't reproduce this issue on my device (Galaxy Fold4, Android 14). I have a few questions regarding to it.

  1. Did this occur with the Flutter sample app located in this repository?
  2. Could you provide the following information: Android device, Android version, LINE App version (and try to upgrade to latest), Flutter LINE SDK version, and the targetSdkVersion of your app ?
  3. Did this occur in other Android devices or emulators? If so, please share the device/emulator's info.
  4. Could you download this app and test it to see if there are any login issues on it (using the same device as mentioned in this issue)? https://play.google.com/store/apps/details?id=com.linecorp.twshopping

I have a Flutter native app

Is it a public access app that I can download?

Thanks.

YkSix avatar Feb 24 '25 16:02 YkSix

Wow, it's late night for us to have discussion here.

  1. No, in the example app, it pops to the example app flawlessly on my actual device.
Android device: Galaxy S23+
Android version: Android 14, OneUI 6.1
LINE app version: 15.1.4 (latest)
Flutter LINE SDK version: 2.3.8
targetSdkVersion: minSdk = 24
                  targetSdk = flutter.targetSdkVersion
  1. In short, IDK. I don't have any extra actual devices around me, and I didn't try to login in native LINE on emulator since it might broke my chat history on my actual device if I'm not wrong.
  2. No issues.
  3. Still in development :(

Example code in my app Edit: in my app, lineSignIn is called after several Navigator.push() (something like HomePage -> ProfilePage -> LoginPage, then a ElevatedButton calls lineSignIn) I don't know if this matters.

Future<dynamic> lineSignIn(context) async {
  Map<String, dynamic> data = {};
  try {
    final loginOption = LoginOption(false, 'normal'); // 設定登入選項
    final result = await LineSDK.instance.login(scopes: ['profile', 'openid', 'email'], option: loginOption); // 執行登入
...
}

Considered myself as a beginner on this SDK and Flutter ecosystem, I might have some improper setup. Feel free to request more info.

As this is not a urgent case, just take it slow and have a great night.

GinoLin980 avatar Feb 24 '25 16:02 GinoLin980

Im facing same issue, with android emulator --> Pixel_6a_API_34, it just created 2 times of access.line.me either i tapped "Allow" or "Cancel" , It just happened in Android and its working fine in IOS

PANGSHENGFENG69 avatar Apr 21 '25 10:04 PANGSHENGFENG69

@YkSix I have this issue to case scenario for reproduce

  1. Open App
  2. Open LINE App
  3. Login with LINE from App
  4. Click allow then LINE toast message login successful
  5. Issue it still on LINE App not redirect to App

but it work fine if we not do step 2. (that mean kill LINE App first) it not happen issue in step 5.

thanakorn-bird-abbon avatar May 28 '25 04:05 thanakorn-bird-abbon

@YkSix I have this issue to case scenario for reproduce

  1. Open App
  2. Open LINE App
  3. Login with LINE from App
  4. Click allow then LINE toast message login successful
  5. Issue it still on LINE App not redirect to App

but it work fine if we not do step 2. (that mean kill LINE App first) it not happen issue in step 5.

For my case solved Root cause is my App disabled deeplink and use app_links Follow document app_links intent-filter look like

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" android:host="www.example.com" android:pathPrefix="/foo" />
</intent-filter>

My update

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="MY_SCHEME" />
    <data android:path="MY_PATH" />
</intent-filter>

My Android URL scheme intent://MY_PATH#Intent;scheme=MY_SCHEME;package=MY_PACKAGE_NAME;

thanakorn-bird-abbon avatar May 28 '25 09:05 thanakorn-bird-abbon

@thanakorn-bird-abbon

Ah, that makes sense! Thank you for the information.

When writing the documentation or designing the workflow and APIs, we must follow and refer only to the official solutions, such as Deep Links. If another solution is used in the app, you'll need to make some adaptations to make it work!

onevcat avatar May 29 '25 01:05 onevcat

I faced the same problem.

@YkSix I have this issue to case scenario for reproduce

  1. Open App
  2. Open LINE App
  3. Login with LINE from App
  4. Click allow then LINE toast message login successful
  5. Issue it still on LINE App not redirect to App

but it work fine if we not do step 2. (that mean kill LINE App first) it not happen issue in step 5.

and try to solved with this solution but it don't work.

@YkSix I have this issue to case scenario for reproduce

  1. Open App
  2. Open LINE App
  3. Login with LINE from App
  4. Click allow then LINE toast message login successful
  5. Issue it still on LINE App not redirect to App

but it work fine if we not do step 2. (that mean kill LINE App first) it not happen issue in step 5.

For my case solved Root cause is my App disabled deeplink and use app_links Follow document app_links intent-filter look like

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" android:host="www.example.com" android:pathPrefix="/foo" />
</intent-filter>

My update

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="MY_SCHEME" />
    <data android:path="MY_PATH" />
</intent-filter>

My Android URL scheme intent://MY_PATH#Intent;scheme=MY_SCHEME;package=MY_PACKAGE_NAME;

jitinics avatar Jun 02 '25 17:06 jitinics

The same issue occurs if you open the Line app first, then return to your own app to initiate Line login. After successful authorization, it cannot automatically redirect from Line back to your own app.

swift-fs avatar Jun 11 '25 11:06 swift-fs

I still have

@YkSix I have this issue to case scenario for reproduce

  1. Open App
  2. Open LINE App
  3. Login with LINE from App
  4. Click allow then LINE toast message login successful
  5. Issue it still on LINE App not redirect to App

but it work fine if we not do step 2. (that mean kill LINE App first) it not happen issue in step 5.

For my case solved Root cause is my App disabled deeplink and use app_links Follow document app_links intent-filter look like

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" android:host="www.example.com" android:pathPrefix="/foo" />
</intent-filter>

My update

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="MY_SCHEME" />
    <data android:path="MY_PATH" />
</intent-filter>

My Android URL scheme intent://MY_PATH#Intent;scheme=MY_SCHEME;package=MY_PACKAGE_NAME;

Sorry everyone I still have issue too I think in that day it work because I use back button in Android (equal close app LINE before login from my App)

It make LINE app close.

thanakorn-bird-abbon avatar Jun 12 '25 12:06 thanakorn-bird-abbon

I have also encountered the same problem. Do you have a solution?

weihq avatar Jul 10 '25 00:07 weihq

I have also encountered the same problem. Do you have a solution?

CodeAndThink avatar Aug 13 '25 02:08 CodeAndThink

I have also encountered the same problem. Do you have a solution?

bvhstar avatar Sep 18 '25 16:09 bvhstar