Code Monkey home page Code Monkey logo

line-sdk-android's Introduction

Maven Central

Overview

The LINE SDK for Android provides a modern way of implementing LINE APIs. The features included in this SDK will help you develop an Android app with engaging and personalized user experience.

Features

The LINE SDK for Android provides the following features.

User authentication

This feature allows users to log in to your service with their LINE accounts. With the help of the LINE SDK for Android, it has never been easier to integrate LINE Login into your app. Your users will automatically log in to your app without entering their LINE credentials if they are already logged in to LINE on their Android devices. This offers a great way for users to get started with your app without having to go through a registration process.

Utilizing user data with OpenID support

Once the user is authorized, you can get the user’s LINE profile. You can utilize the user's information registered in LINE without building your user system.

The LINE SDK supports the OpenID Connect 1.0 specification. You can get ID tokens that contain the user’s LINE profile when you retrieve the access token.

Setup

Pre-request

Create your own LINE Channel and follow the instructions here to link your app to your channel.

Gradle

Add mavenCentral to your repositories if it's not added yet.

repositories {
    ...
	mavenCentral()
}

Import line-sdk dependency

dependencies {
    implementation 'com.linecorp.linesdk:linesdk:$linesdk_version'
    ...
}

Quickstart

A pre-defined LINE login button is provided. You can add it to the user interface of your app to provide your users with a quick way to log in as below

Add login buton to layout xml

<com.linecorp.linesdk.widget.LoginButton
    android:id="@+id/line_login_btn"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

Use it in codes

LoginButton loginButton = rootView.findViewById(R.id.line_login_btn);

// if the button is inside a Fragment, this function should be called.
loginButton.setFragment(this); 

// replace the string to your own channel id.
loginButton.setChannelId("the channel id you created");

// configure whether login process should be done by LINE App, or by WebView.
loginButton.enableLineAppAuthentication(true);

// set up required scopes. 
loginButton.setAuthenticationParams(new LineAuthenticationParams.Builder()
        .scopes(Arrays.asList(Scope.PROFILE))
        .build()
);

// A delegate for delegating the login result to the internal login handler. 
private LoginDelegate loginDelegate = LoginDelegate.Factory.create();
loginButton.setLoginDelegate(loginDelegate);

loginButton.addLoginListener(new LoginListener() {
    @Override
    public void onLoginSuccess(@NonNull LineLoginResult result) {
        Toast.makeText(getContext(), "Login success", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onLoginFailure(@Nullable LineLoginResult result) {
        Toast.makeText(getContext(), "Login failure", Toast.LENGTH_SHORT).show();
    }
});

For more information, refer to the LINE SDK for Android guide on the LINE Developers site.

Try the starter app

To have a quick look at the features of the LINE SDK, try our starter app by following the steps below:

  1. Clone the repository.

    git clone https://github.com/line/line-sdk-android.git

  2. Build the starter app.

    ./gradlew app:assembleDebug

The starter app apk file will be built as app/build/outputs/apk/debug/app-debug.apk.

Contributing

If you believe you have discovered a vulnerability or have an issue related to security, please DO NOT open a public issue. Instead, send us a mail to [email protected].

For contributing to this project, please see CONTRIBUTING.md.

line-sdk-android's People

Contributors

benjamin-cheng avatar cherenkov avatar coffeephile avatar dropfl avatar hayasilin avatar liying2010 avatar marshallgunnell avatar onevcat avatar perthcpe23 avatar plateaukao avatar tsairene avatar wouter-veeken avatar xanonymous-github avatar yksix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

line-sdk-android's Issues

LineApiError{httpResponseCode=200, message='java.io.IOException: org.json.JSONException: Unable to load class named [io.jsonwebtoken.io.JacksonDeserializer]

What did you do?

3rd Login

What did you expect?

get user email information

What happened actually?

Login FAILED!
E/ERROR: LineApiError{httpResponseCode=200, message='java.io.IOException: org.json.JSONException: Unable to load class named [io.jsonwebtoken.io.JacksonDeserializer] from the thread context, current, or system/application ClassLoaders. All heuristics have been exhausted. Class could not be found.

Your environment?

implementation 'com.linecorp.linesdk:linesdk:5.4.1'

Not installed line application , can't return to the app

1.Not installed line application
2.login using browser
3.cancel login
4.can't return to the app

dumpsys activity activities:
first task is com.android.browser/.BrowserActivity
second is com.linecorp.linesdk.auth.internal.LineAuthenticationActivity

how can I return my app when cancel login.

[Q OS] LineLoginApi.getLoginIntent(...) is not working properly

At Q OS, LineLoginApi.getLoginIntent(...) is not working properly.
If a user clicks "Allow" button, "Grant permission?" screen is shown again.
Please check this operation. :)

  • Device: Pixel 2
  • Android Version: Q (QPP1.190205.018.B4)
  • LINE App Version: 9.4.2

Text_highligh Specifies the same color ID

Is it a security issue?

Not

What did you do?

The Colors directory in the SDK has many color values that are too generic, such as text_highlight, background, etc. This time our app has the same color ID as the Line SDK, which causes the LINE SDK colors to overwrite our app. We solved this problem in other ways

What did you expect?

I hope the Line SDK can consider this aspect of naming, such as adding a prefix or a relatively unique ID

What happened actually?

The same color ID causes the line color to cover our app
our app
color name="text_highlight">@color/ck_orange
line app
color name="text_highlight">#07bf3f

Crash parser when user Scope.PROFILE,Scope.OPENID_CONNECT

Is it a security issue?

No?

If you believe you have discovered a vulnerability or have an issue related to security, please send us a mail to [email protected] instead of opening a public issue.

What did you do?

I requested with this parameters.

      val intent = LineLoginApi.getLoginIntent(
        requireContext(), BuildConfig.LINE_CHANNEL_ID, LineAuthenticationParams.Builder()
          .scopes(arrayListOf(Scope.PROFILE, Scope.OPENID_CONNECT))
          .build()
      )
      startActivityForResult(intent, REQUEST_LINE_SIGN_IN)

I gave response error and not got token on release build using R8 full mode. But debug build not occurred.

06-05 12:54:44.234  1068  8022 I ActivityTaskManager: START u0 {dat=lineauth://result?code=hogeFuga flg=0x14000000 cmp=jp.cldh/com.linecorp.linesdk.auth.internal.LineAuthenticationActivity} from uid 10635
06-05 12:54:44.238  1068  8022 W ActivityTaskManager: Duplicate finish request for ActivityRecord{4a2af0a u0 jp.cldh/com.linecorp.linesdk.auth.internal.LineAuthenticationCallbackActivity t27405 f}
06-05 12:54:44.299 23070 23249 E IdTokenParser: failed to parse IdToken: hogefuga
06-05 12:54:44.299 23070 23249 E IdTokenParser: r.b.d.g: Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser] from the thread context, current, or system/application ClassLoaders.  All heuristics have been exhausted.  Class could not be found.
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at r.b.b.a(:1)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at com.linecorp.linesdk.internal.nwclient.IdTokenParser.a(Unknown Source:8)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient$IssueAccessTokenResultParser.a(:3)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at com.linecorp.linesdk.internal.nwclient.JsonToObjectBaseResponseParser.a(Unknown Source:6)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at com.linecorp.linesdk.internal.nwclient.core.ChannelServiceHttpClient.a(Unknown Source:99)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at com.linecorp.linesdk.internal.nwclient.core.ChannelServiceHttpClient.b(:2)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at com.linecorp.linesdk.auth.internal.LineAuthenticationController$AccessTokenRequestTask.doInBackground(:1)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at android.os.AsyncTask$3.call(AsyncTask.java:378)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
06-05 12:54:44.299 23070 23249 E IdTokenParser: 	at java.lang.Thread.run(Thread.java:919)

Your environment?

Android OS: Q beta 3
Device: Essential Phone PH-1
LINE SDK Version: 5.0.1

and emulator Android OS: SDK_INT=28

Help needed: integrating with Capacitor's OAuth2 plugin

Hello,

Capacitor is a new PWA framework that is also going to be integrated into the well known Ionic Framework, which is now based on Cordova (that said, Capacitor will eventually replace Cordova).

I need some suggestions on how the Line Login API could be integrated into Capacitor's OAuth2 plugin. At first, I thought it might look similar to Facebook, but seems Line SDK for Android lacks ready-to-use login activity and callbacks that can be used. I was able to integrate it on iOS, but now struggle with Android. Some examples would be really helpful.

PS: Cordova suggestions would also be helpful as long as they could be adapted to Capacitor, some plugins already exist, but they are based on old SDK versions.

Use ActivityResultContracts as onActivityResult is deprecated

Is it a security issue?

  • No

What did you do?

  • Integrating LINE Login.

What did you expect?

  • Do not appear 'deprecated' warning

What happened actually?

Your environment?

  • Normal Android development environment.

Sample project

  • Just create new Android project from Android Studio and write 'onActivityResult' override function in Activity class.
    • image

How to fix

Caused by: java.lang.ClassNotFoundException: com.linecorp.linesdk.auth.LineAuthenticationConfig

05-12 05:19:17.821 1536 2494 E Parcel : Class not found when unmarshalling: com.linecorp.linesdk.auth.LineAuthenticationConfig
05-12 05:19:17.821 1536 2494 E Parcel : java.lang.ClassNotFoundException: com.linecorp.linesdk.auth.LineAuthenticationConfig
05-12 05:19:17.821 1536 2494 E Parcel : at java.lang.Class.classForName(Native Method)
05-12 05:19:17.821 1536 2494 E Parcel : at java.lang.Class.forName(Class.java:453)
05-12 05:19:17.821 1536 2494 E Parcel : at android.os.Parcel.readParcelableCreator(Parcel.java:2834)
05-12 05:19:17.821 1536 2494 E Parcel : at android.os.Parcel.readParcelable(Parcel.java:2788)
05-12 05:19:17.821 1536 2494 E Parcel : at android.os.Parcel.readValue(Parcel.java:2691)
05-12 05:19:17.821 1536 2494 E Parcel : at android.os.Parcel.readArrayMapInternal(Parcel.java:3058)
05-12 05:19:17.821 1536 2494 E Parcel : at android.os.BaseBundle.unparcel(BaseBundle.java:257)
05-12 05:19:17.821 1536 2494 E Parcel : at android.os.BaseBundle.getString(BaseBundle.java:1086)
05-12 05:19:17.821 1536 2494 E Parcel : at android.content.Intent.getStringExtra(Intent.java:7706)
05-12 05:19:17.821 1536 2494 E Parcel : at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:459)
05-12 05:19:17.821 1536 2494 E Parcel : at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:410)
05-12 05:19:17.821 1536 2494 E Parcel : at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1277)
05-12 05:19:17.821 1536 2494 E Parcel : at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:5988)
05-12 05:19:17.821 1536 2494 E Parcel : at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5841)
05-12 05:19:17.821 1536 2494 E Parcel : at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
05-12 05:19:17.821 1536 2494 E Parcel : at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3818)
05-12 05:19:17.821 1536 2494 E Parcel : at android.os.Binder.execTransact(Binder.java:682)
05-12 05:19:17.821 1536 2494 E Parcel : Caused by: java.lang.ClassNotFoundException: com.linecorp.linesdk.auth.LineAuthenticationConfig
05-12 05:19:17.821 1536 2494 E Parcel : at java.lang.Class.classForName(Native Method)
05-12 05:19:17.821 1536 2494 E Parcel : at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
05-12 05:19:17.821 1536 2494 E Parcel : at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
05-12 05:19:17.821 1536 2494 E Parcel : at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
05-12 05:19:17.821 1536 2494 E Parcel : ... 17 more
05-12 05:19:17.821 1536 2494 E Parcel : Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
05-12 05:19:17.822 1536 2494 W Bundle : Failed to parse Bundle, but defusing quietly
05-12 05:19:17.822 1536 2494 W Bundle : android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.linecorp.linesdk.auth.LineAuthenticationConfig
05-12 05:19:17.822 1536 2494 W Bundle : at android.os.Parcel.readParcelableCreator(Parcel.java:2862)
05-12 05:19:17.822 1536 2494 W Bundle : at android.os.Parcel.readParcelable(Parcel.java:2788)
05-12 05:19:17.822 1536 2494 W Bundle : at android.os.Parcel.readValue(Parcel.java:2691)
05-12 05:19:17.822 1536 2494 W Bundle : at android.os.Parcel.readArrayMapInternal(Parcel.java:3058)
05-12 05:19:17.822 1536 2494 W Bundle : at android.os.BaseBundle.unparcel(BaseBundle.java:257)
05-12 05:19:17.822 1536 2494 W Bundle : at android.os.BaseBundle.getString(BaseBundle.java:1086)
05-12 05:19:17.822 1536 2494 W Bundle : at android.content.Intent.getStringExtra(Intent.java:7706)
05-12 05:19:17.822 1536 2494 W Bundle : at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:459)
05-12 05:19:17.822 1536 2494 W Bundle : at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:410)
05-12 05:19:17.822 1536 2494 W Bundle : at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1277)
05-12 05:19:17.822 1536 2494 W Bundle : at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:5988)
05-12 05:19:17.822 1536 2494 W Bundle : at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5841)
05-12 05:19:17.822 1536 2494 W Bundle : at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
05-12 05:19:17.822 1536 2494 W Bundle : at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3818)
05-12 05:19:17.822 1536 2494 W Bundle : at android.os.Binder.execTransact(Binder.java:682)
05-12 05:19:17.823 1536 2494 I ActivityManager: START u0 {act=null typ=null flg=0x0 cmp=ComponentInfo{com.netease.lrsjp.netease_global/com.linecorp.linesdk.auth.internal.LineAuthenticationActivity}} from uid 10495

LineApiError{httpResponseCode=-1, message='Illegal parameter value of 'state'.', errorCode='NOT_DEFINED'

Is it a security issue?

Not

What did you do?

Use the LINE SDK For Android,Test login, showing error:LineApiError{httpResponseCode=-1, message='Illegal parameter value of 'state'.', errorCode='NOT_DEFINED'

Your environment?

Line Android SDK v5.7.0
Android targetSdkVersion = 30
Android minSdkVersion = 19
Device : vivo 1904(Android 11)

Sample project

I can show my CODE:

public void login(int callbackId, String param) {
mCallBackKey = callbackId;
setListener();

    try {
        Intent loginIntent = LineLoginApi.getLoginIntent(mContext, mChannelID,new LineAuthenticationParams.Builder()
                .scopes(Arrays.asList(Scope.PROFILE))
                // .nonce("<a randomly-generated string>") // nonce can be used to improve security
                .build());
        ((Activity)mContext).startActivityForResult(loginIntent, REQUEST_CODE);
    } catch (Exception e) {
        Log.e("ERROR", e.toString());
    }

}

public void onLoginResult(Intent data) {
LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data);

    JSONObject jsonObj = new JSONObject();
    try {
        LineApiResponseCode resCode = result.getResponseCode();
        switch (resCode) {
            case SUCCESS:
                // Login successful
                break;

            case CANCEL:
                // Login canceled by user
                break;

            default:
                // Login canceled due to other error
                String msg = result.getErrorData().toString();
                Log.e("Line Auth ERROR", result.getErrorData().toString());
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

}

Migrate support libraries to AndroidX

What did you expect?

I'm trying to remove android.enableJetifier=true from my project. But linesdk still uses android support libraries. Could you please migrate used support libraries to AndroidX.

I think this b0f869d commit is not included in v5.7.0. When can I use v5.8.0?

How can I config redirect_uri in Line sdk?

Is it a security issue?

If you believe you have discovered a vulnerability or have an issue related to security, please send us a mail to [email protected] instead of opening a public issue.

What did you do?

Please describe what you did before you encounter the issue.

What did you expect?

Please describe what you did expect to happen.

What happened actually?

Please describe what happened actually.

Your environment?

Some information of the environment in which the issue happened. LINE SDK version, Android Studio version, Andorid version, etc.

Sample project

It would be appreciated if you can provide a link to or update a sample project that we can download and reproduce the issue.

Reduce dependencies of Line SDK

What did you do?

I try to install Line SDK 5.0.0 in my app for line login.

What did you expect?

Add the following code only.

implementation(name:'line-sdk-5.0.0', ext:'aar')

What happened actually?

Too much dependencies are exists.

I think, the following libs are needed for Line SDK only.

implementation('com.madgag.spongycastle:prov:1.58.0.0') {
    exclude group: 'junit', module: 'junit'
}
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.10.5'
runtimeOnly ('io.jsonwebtoken:jjwt-orgjson:0.10.5') {
    exclude group: 'org.json', module: 'json' //provided by Android natively
}

And at 'kotlin only' projects, the followings are also unneeded.

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

Your environment?

Sample project

Android 12 Device LINE app-to-app login not working

Is it a security issue?

If you believe you have discovered a vulnerability or have an issue related to security, please send us a mail to [email protected] instead of opening a public issue.

What did you do?

app-to-app login (LineLoginApi.getLoginIntent)

What did you expect?

The LINE app login flow starts, and the UI is exposed to the user to check the login consent.

What happened actually?

just error popup (korean: 오류 정상적으로 처리하지 못하였습니다.)

Your environment?

Android 12 device, targetSDKversion 30 app

Sample project

sorry. this is only company test app, and it cannot be leaked to the outside.

(+)
in Android 12 device, I tried to web log-in. However, the web-login API(getLoginIntentWithoutLineAppAuth) does not work.
this api is not working all device. (android 10, 11, 12)

samsung Galaxy C5 Android8.0 Automatically cancel login

samsung Galaxy C5 Android8.0 Automatically cancel login

In the mobile phone Samsung Galaxy C5 Android8.0 use demo login, when the Line app is open, the normal authorization login, when the Line app is not running, the authorization will be adjusted, and then jump back, result.getResponseCode() = CANCEL.

lineSdk release version error

line sdk apk release version

Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser] from the thread context, current, or system/application ClassLoaders. All heuristics have been exhausted. Class could not be found.\n\tat com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient$IssueAccessTokenResultParser.parseJsonToObject(LineAuthenticationApiClient.java:14)\n\tat com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient$IssueAccessTokenResultParser.parseJsonToObject(LineAuthenticationApiClient.java:1)\n\tat com.linecorp.linesdk.internal.nwclient.JsonToObjectBaseResponseParser.getResponseData(JsonToObjectBaseResponseParser.java:1)

LineLoginButton not work with IDToken

What did you do?

I followed your example, but I also need user's email so I added two more scopes, Open ID Connect, and Email in MenuFragment.java:78.

I did config Channel's permission to allow access to user's email.

// before
lineLoginButton.setAuthenticationParams(new LineAuthenticationParams.Builder()
    .scopes(Arrays.asList(Scope.PROFILE))
    .build()
);

// after
lineLoginButton.setAuthenticationParams(new LineAuthenticationParams.Builder()
    .scopes(Arrays.asList(Scope.PROFILE,Scope.OPENID_CONNECT,Scope.OC_EMAIL))
    .build()
);

What did you expect?

I expected an Email from login result

@Override
public void onLoginSuccess(@NonNull LineLoginResult result) {
    Toast.makeText(getContext(), result.getLineIdToken().getEmail(),Toast.LENGTH_SHORT).show();
}

What happened actually?

I got error saying

2018-11-29 11:09:08.416 8036-8231/com.linecorp.linesdktest E/IdTokenParser: failed to parse IdToken: [REMOVED]
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.Uri$Builder android.net.Uri.buildUpon()' on a null object reference
        at com.linecorp.linesdk.utils.UriUtils.uriBuilder(UriUtils.java:23)
        at com.linecorp.linesdk.utils.UriUtils.buildUri(UriUtils.java:49)
        at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient.getOpenIdDiscoveryDocument(LineAuthenticationApiClient.java:262)
        at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient.getJWKSet(LineAuthenticationApiClient.java:278)
        at com.linecorp.linesdk.internal.nwclient.OpenIdSigningKeyResolver.resolveSigningKey(OpenIdSigningKeyResolver.java:82)
        at com.linecorp.linesdk.internal.nwclient.OpenIdSigningKeyResolver.resolveSigningKey(OpenIdSigningKeyResolver.java:73)
        at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:342)
        at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:513)
        at io.jsonwebtoken.impl.DefaultJwtParser.parseClaimsJws(DefaultJwtParser.java:573)
        at com.linecorp.linesdk.internal.nwclient.IdTokenParser.parse(IdTokenParser.java:36)
        at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient$IssueAccessTokenResultParser.parseIdToken(LineAuthenticationApiClient.java:167)
        at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient$IssueAccessTokenResultParser.parseJsonToObject(LineAuthenticationApiClient.java:154)
        at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient$IssueAccessTokenResultParser.parseJsonToObject(LineAuthenticationApiClient.java:133)
        at com.linecorp.linesdk.internal.nwclient.JsonToObjectBaseResponseParser.getResponseData(JsonToObjectBaseResponseParser.java:39)
        at com.linecorp.linesdk.internal.nwclient.core.ChannelServiceHttpClient.getChannelServiceResponse(ChannelServiceHttpClient.java:335)
        at com.linecorp.linesdk.internal.nwclient.core.ChannelServiceHttpClient.post(ChannelServiceHttpClient.java:101)
        at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient.issueAccessToken(LineAuthenticationApiClient.java:126)
        at com.linecorp.linesdk.auth.internal.LineAuthenticationController$AccessTokenRequestTask.doInBackground(LineAuthenticationController.java:250)
        at com.linecorp.linesdk.auth.internal.LineAuthenticationController$AccessTokenRequestTask.doInBackground(LineAuthenticationController.java:231)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

How to fix

Turned out openidDiscoveryDocumentUrl has been null all along.
So I added this line at LineAuthenticationConfig.java:166

openidDiscoveryDocumentUrl = Uri.parse(BuildConfig.OPENID_DISCOVERY_DOCUMENT_URL); // add this line

So that it looks like this:

// before
public Builder(@NonNull String channelId) {
    if (TextUtils.isEmpty(channelId)) {
        throw new IllegalArgumentException("channelId is empty.");
    }
    this.channelId = channelId;
    apiBaseUrl = Uri.parse(BuildConfig.API_SERVER_BASE_URI);
    webLoginPageUrl = Uri.parse(BuildConfig.WEB_LOGIN_PAGE_URL);
}

// after
public Builder(@NonNull String channelId) {
    if (TextUtils.isEmpty(channelId)) {
        throw new IllegalArgumentException("channelId is empty.");
    }
    this.channelId = channelId;
    apiBaseUrl = Uri.parse(BuildConfig.API_SERVER_BASE_URI);
    webLoginPageUrl = Uri.parse(BuildConfig.WEB_LOGIN_PAGE_URL);
    openidDiscoveryDocumentUrl = Uri.parse(BuildConfig.OPENID_DISCOVERY_DOCUMENT_URL); // add this line
}

Then my issue was solved, but I'm not sure I solved it properly or by accident. Please check.

Your environment?

Android 8.1.0
Line SDK version 5.0.0
Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 9, 2018
JRE: 1.8.0_152-release-1136-b06 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.1

Sample project

Forked project: https://github.com/perthcpe23/line-sdk-android

channel id is empty

I found crash on online version.I check my code, I set currect chennel Id when launch line.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{/com.linecorp.linesdk.openchat.ui.CreateOpenChatActivity}: java.lang.IllegalArgumentException: channel id is empty
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2951)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

line login activity not return to my app but stay at the ask for permission page

Is it a security issue?

i think no

What did you do?

use line sdk in my app

when i loging success
it will jump to ask for permission page

in ask for permission page
when i click allow , it not return back to my app

What did you expect?

it's sholud return my app when i click allow

What happened actually?

in ask for permission page
when i click allow , it not return back to my app

Your environment?

cococs 2dx app

AccessToken is no longer available If the app is updated to targetSdkVersion 28

Is it a security issue?

No

What did you do?

  1. Build and run the sample app as it is (targetSdkVersion 26)
  2. Log in with LINE
  3. Click [APIs] button to navigate to ApisFragment
  4. Click [getCurrentToken] and check that access token is available in the generated log.
  5. Build the app again with targetSdkVersion 28
  6. Click [APIs] button to navigate to ApisFragment again.
  7. Click [getCurrentToken]

What did you expect?

Access token should be available as before.

What happened actually?

Got INTERNAL_ERROR log with message of "The cached access token does not exist'

Your environment?

LINE sdk 5.1, Android Studio 3.5, Android Pie, SM-G950N

Sample project

You can reproduce the issue just by changing targetSdkVersion to 28


As you may already know, Google Play requires all apps to target api 28 from November 2019. (https://developer.android.com/distribute/best-practices/develop/target-sdk)
So I would need your immediate attention to this issue to keep maintaining my app in Google Play even after the new policy is applied on Nov.

version5.0.1 java.lang.NoClassDefFoundError: com.linecorp.linesdk.internal.nwclient.OpenIdSigningKeyResolver

Such an error occurs. What are the possible causes?

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.nrikiji.linetest314, PID: 2431
                  java.lang.NoClassDefFoundError: com.linecorp.linesdk.internal.nwclient.OpenIdSigningKeyResolver
                      at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient.<init>(LineAuthenticationApiClient.java:59)
                      at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient.<init>(LineAuthenticationApiClient.java:71)
                      at com.linecorp.linesdk.auth.internal.LineAuthenticationController.<init>(LineAuthenticationController.java:75)
                      at com.linecorp.linesdk.auth.internal.LineAuthenticationActivity.onCreate(LineAuthenticationActivity.java:90)
                      at android.app.Activity.performCreate(Activity.java:6285)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)
                      at android.app.ActivityThread.access$900(ActivityThread.java:154)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:234)
                      at android.app.ActivityThread.main(ActivityThread.java:5526)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

https://developers.line.biz/ja/docs/android-sdk/integrate-line-login/
When installing the SDK and executing the following code by this procedure it will crash...

package com.example.nrikiji.linetest314;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import com.linecorp.linesdk.Scope;
import com.linecorp.linesdk.auth.LineAuthenticationParams;
import com.linecorp.linesdk.auth.LineLoginApi;
import com.linecorp.linesdk.auth.LineLoginResult;

import java.util.Arrays;

public class MainActivity extends AppCompatActivity {

    private static final int REQUEST_CODE = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        try{
            // App-to-app login
            Intent loginIntent = LineLoginApi.getLoginIntent(
                    getApplicationContext(),
                    "1565553788",
                    new LineAuthenticationParams.Builder()
                            .scopes(Arrays.asList(Scope.PROFILE))
                            .build());
            startActivityForResult(loginIntent, REQUEST_CODE); // ★ Crash!!

        }
        catch(Exception e) {
            Log.e("ERROR", e.toString());
        }
    }

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode != REQUEST_CODE) {
            Log.e("ERROR", "Unsupported Request");
            return;
        }

        LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data);

        switch (result.getResponseCode()) {

            case SUCCESS:
                // Login successful
                String accessToken = result.getLineCredential().getAccessToken().getTokenString();
                break;

            case CANCEL:
                // Login canceled by user
                Log.e("ERROR", "LINE Login Canceled by user.");
                break;

            default:
                // Login canceled due to other error
                Log.e("ERROR", "Login FAILED!");
                Log.e("ERROR", result.getErrorData().toString());
        }
    }}

The version of android studio is 3.1.4 and the development environment can not be upgraded above this due to circumstances of ...

The SDK cannot import my project

hi i want to ask
Where is the sdk .aar file?
Or how to import line sdk into my own project,
I followed the documentation teaching without success.

gratitude

Publish SDK artifacts to maven

At first, current release 5.0.1 is not added to Releases, so it is required to build project manually to get latest SDK.
Also in 2k19 it is really strange to have SDK not published to jcenter/other maven and require developers to manually add artifacts to their projects, please fix it.

Crash in com.linecorp.linesdk.auth.internal.LineAuthenticationController$RequestTokenRequestTask.onPostExecute

Fatal Exception: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.VIEW dat=https://access.line.me/... cmp=com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ActivityWebBrowser (has extras) } from ProcessRecord{471705a 31272:chat.meme.inke/u0a244} (pid=31272, uid=10244) not exported from uid 10225
at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3696)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1723)
at android.app.Activity.startActivityForResult(Activity.java:5437)
at com.linecorp.linesdk.auth.internal.LineAuthenticationController$RequestTokenRequestTask.onPostExecute(LineAuthenticationController.java:1146)
at android.os.AsyncTask.finish(AsyncTask.java:771)
at android.os.AsyncTask.access$900(AsyncTask.java:199)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7977)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:948)

New Feature: add a new param for login pages language customizing

Is it a security issue?

No, it's a Feature Request

LINE Login Web Pages supports a URL query param "lang", which can be used to make the web pages displayed in a specific language instead of the Browser default language.

I think it will be good if we add this param to LINE SDK, so SDK user can use it to customize the Login Pages language

update:
after discussing with LINE Login develop team, they said, according to OpenID Connect 1.0 protocol , they like to use "ui_locales" as parameter name

build problem: Missing class com.linecorp.linesdk.BR

What did you do?

run release build:

        buildTypes {
            getByName("release") {
                isMinifyEnabled = false
                isShrinkResources = false
                isCrunchPngs = false
                proguardFiles(
                    getDefaultProguardFile("proguard-android-optimize.txt"),
                    "proguard-rules.pro"
                )
            }
        }

What did you expect?

build success

What happened actually?

build fail and show:

Missing class com.linecorp.linesdk.BR (referenced from: boolean com.linecorp.linesdk.databinding.OpenChatInfoFragmentBindingImpl.onChangeViewModelChatroomName(androidx.lifecycle.MutableLiveData, int) and 1 other context)

my solve way

add -dontwarn com.linecorp.linesdk.BR in proguard-rules.pro

environment

LINE SDK version:5.8.1
Android Studio version:Android Studio Flamingo | 2022.2.1
AGP:8.0
Gradle:8.0

An error will occur in the build. What kind of cause can be considered?

The following error occurs at build time.
What kind of cause can be considered?
I succeeded in building the example application of this repository.
SDK Version is 5.0.1

Error:Exception in thread "main" java.lang.IllegalStateException: Expected a load for Landroid/view/View$OnClickListener; to set up parameter 1 for com/linecorp/linesdk/widget/LoginButton$$Lambda$3 but got -1
	at com.google.common.base.Preconditions.checkState(Preconditions.java:756)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.attemptAllocationBeforeArgumentLoads(LambdaDesugaring.java:543)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:427)
	at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1623)
	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1126)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:698)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
	at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
	at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
	at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
	at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)

FAILURE: Build failed with an exception.

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.example.xxxxx.linelogintest"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation('com.madgag.spongycastle:prov:1.58.0.0')
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation(name:'line-sdk-5.0.1', ext:'aar')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Failed Build Android (React Native) on LINE SDK 5.0.1, java.lang.NoClassDefFoundError: com.linecorp.linesdk.internal.nwclient.OpenIdSigningKeyResolver

Is it a security issue?

No

What did you expect?

Successfully build (on 4.0.0 success)

What happened actually?

Build failed and i got an error:

java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:309)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.NoClassDefFoundError: com.linecorp.linesdk.internal.nwclient.OpenIdSigningKeyResolver
        at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient.<init>(LineAuthenticationApiClient.java:59)
        at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient.<init>(LineAuthenticationApiClient.java:71)
        at com.linecorp.linesdk.api.LineApiClientBuilder.build(LineApiClientBuilder.java:103)
        at com.xmartlabs.lineloginmanager.LineLogin.getLineApiClient(LineLogin.java:115)
        at com.xmartlabs.lineloginmanager.LineLogin.access$200(LineLogin.java:27)
        at com.xmartlabs.lineloginmanager.LineLogin$LogoutTask.doInBackground(LineLogin.java:148)
        at com.xmartlabs.lineloginmanager.LineLogin$LogoutTask.doInBackground(LineLogin.java:145)

Your environment?

LINE SDK version: 5.0.1
React Native: 0.59.3
Android configuration:
buildToolsVersion = "28.0.2"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"

Version 5.6.0 dependencies Error

I use version 5.6.0 in my gradle build,but I got an build error like below.

`
Could not determine the dependencies of task ':rsdk_line:compileDebugAidl'.

Could not resolve all task dependencies for configuration ':rsdk_line:debugCompileClasspath'.
Could not find :unspecified:.
Required by:
project :rsdk_line > com.linecorp.linesdk:linesdk:5.6.0

Possible solution:

and I found the pom.xml file contains a dependencies like below, can you fix it?
<dependency> <groupId/> <artifactId>unspecified</artifactId> <version/> </dependency>

When login with webview, the login button is gray

What did you do?

I intergrate Line SDK 5.3.1 on my project, when do login with webview ,webview remembers the username and password,which causes the login button to be gray all the time,which may mislead the user and make them feel that the button is not clickable。

below is the screenshot

image

What did you expect?

When webview remembering the password, the login button should not be grayed out

What happened actually?

When webview remembering the password, the login button is gray

Your environment?

Android Line SDK 5.3.1

E/AndroidRuntime: FATAL EXCEPTION: main

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/linecorp/linesdk/R$layout;
    at com.linecorp.linesdk.auth.internal.LineAuthenticationActivity.onCreate(LineAuthenticationActivity.java:66)
    at android.app.Activity.performCreate(Activity.java:5990)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
    at android.app.ActivityThread.access$800(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5254)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.linecorp.linesdk.R$layout" 

Line sdk returns wrong token

Android line sdk returns token and if you validate it via https://api.line.me/oauth2/v2.1/verify, it returns {"message":"failed to parse"}

What is wrong? also if you check token here https://jwt.io/#debugger-io, it says:

Looks like your JWT payload is not a valid JSON object. JWT payloads must be top level JSON objects as per https://tools.ietf.org/html/rfc7519#section-7.2

example of returned token by sdk:

eyJhbGciOiJIUzI1NiJ9.eGkRSBen6bnfAUut4hMlgMktS7uzo_q4VL3i0YD0jEleS2oiSpZUSnplrcUSJQ3wSfvv6B1B9dpwXoXRfDprUpI4_RTR_KSLuDvrrfLTsfqNAIxrBw4bvsM3uoNlNl1ea8wVCHuKxgvgRMv1i-4vRdmPhjjQL5acfYkWnqmJT_E.mDbbYdWz0BWz_2NsgtU-cdJq4SQz_UJ4p4wlNoljKV0

Line sdk 5.8.1 - login issue - crash

Crash Stack

java.lang.NullPointerException

Attempt to invoke virtual method 'com.linecorp.linesdk.auth.internal.LineAuthenticationStatus$Status com.linecorp.linesdk.auth.internal.LineAuthenticationStatus.getStatus()' on a null object reference

1 com.linecorp.linesdk.auth.internal.LineAuthenticationActivity.onNewIntent(LineAuthenticationActivity.java:119)
2 android.app.Activity.performNewIntent(Activity.java:7977)
3 android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1406)
4 android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1419)
5 android.app.ActivityThread.deliverNewIntents(ActivityThread.java:3752)
6 android.app.ActivityThread.handleNewIntent(ActivityThread.java:3764)
7 android.app.servertransaction.NewIntentItem.execute(NewIntentItem.java:53)
8 android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140)
9 android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:100)
10 android.app.ActivityThread$H.handleMessage(ActivityThread.java:2239)
11 android.os.Handler.dispatchMessage(Handler.java:107)
12 android.os.Looper.loop(Looper.java:227)
13 android.app.ActivityThread.main(ActivityThread.java:7822)
14 java.lang.reflect.Method.invoke(Native Method)
15 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
16 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1026)

What happened actually?

In Android developer options - enable do not keep activities, this problem must appear

In com.linecorp.linesdk.auth.internal.LineAuthenticationActivity
Cause by LineAuthenticationStatus.getStatus()' on a null object reference

In this case, the system is in power saving mode and background activities have been terminated

Your environment?

Line SDK 5.8.1
Android Studio Chipmunk | 2021.2.1 Patch 2
Gradle 7.3.3
AGP 7.2.2

EndUser Environment

RMX2020
Android 10,level 29
Oppo/COLOROS
arm64-v8a

App Tracking

0 2023-04-17 20:55:07 com.linecorp.linesdk.auth.internal.LineAuthenticationCallbackActivity onCreated
1 2023-04-17 20:55:08 com.linecorp.linesdk.auth.internal.LineAuthenticationCallbackActivity onCreated
2 2023-04-17 20:55:08 com.linecorp.linesdk.auth.internal.LineAuthenticationActivity onCreated

[Android]Crash parser when use scope Scope.PROFILE, Scope.OPENID_CONNECT,Scope.OC_EMAIL

I use line-sdk-5.0.0.aar for my application

i use custom authentication with code :
Intent loginIntent = LineLoginApi.getLoginIntent(
LoginActivity.this,
Constant.CHANEL_ID,
new LineAuthenticationParams.Builder()
.scopes(Arrays.asList(Scope.PROFILE, Scope.OPENID_CONNECT,Scope.OC_EMAIL))
.build());
startActivityForResult(loginIntent, Constant.REQUEST_CODE_LINE);

I give response error:

java.io.IOException: org.json.JSONException: Attempt to invoke virtual method 'android.net.Uri$Builder android.net.Uri.buildUpon()' on a null object reference
at com.linecorp.linesdk.internal.nwclient.JsonToObjectBaseResponseParser.getResponseData(JsonToObjectBaseResponseParser.java:41)
at com.linecorp.linesdk.internal.nwclient.core.ChannelServiceHttpClient.getChannelServiceResponse(ChannelServiceHttpClient.java:335)
at com.linecorp.linesdk.internal.nwclient.core.ChannelServiceHttpClient.post(ChannelServiceHttpClient.java:101)
at com.linecorp.linesdk.auth.internal.LineAuthenticationController$AccessTokenRequestTask.doInBackground(LineAuthenticationController.java:5126)
at com.linecorp.linesdk.auth.internal.LineAuthenticationController$AccessTokenRequestTask.doInBackground(LineAuthenticationController.java:231)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: org.json.JSONException: Attempt to invoke virtual method 'android.net.Uri$Builder android.net.Uri.buildUpon()' on a null object reference
at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient$IssueAccessTokenResultParser.parseJsonToObject(LineAuthenticationApiClient.java:156)
at com.linecorp.linesdk.internal.nwclient.LineAuthenticationApiClient$IssueAccessTokenResultParser.parseJsonToObject(LineAuthenticationApiClient.java:133)
at com.linecorp.linesdk.internal.nwclient.JsonToObjectBaseResponseParser.getResponseData(JsonToObjectBaseResponseParser.java:39)
... 10 more

PLEASE HELP ME Resolve it
Thanks

Remove allowBackup in application tag

Is it a security issue?

no

What did you do?

Consume Line SDK 5.4.1 to 5.8.0. They declare allowBackup as false in AndroidManifest.

What did you expect?

I believe the consumer should declare this, not the library. If an application have allow backup set to true, they need to use tools:replace tag to override the value from this library.

This is somehow acceptable.

However, if there is another library which set the flag to true, the overriding of the consumer result in an error during lint. For example, here is my stacktrace

Attribute application@allowBackup value=(false) from [com.linecorp.linesdk:linesdk:5.8.0] AndroidManifest.xml:22:9-36
        is also present at <...> AndroidManifest.xml:20:9-35 value=(true).

What happened actually?

The library has allowBackup declaration

Having trouble on building the starter app

Is it a security issue?

No

What did you do?

I'm trying to build the starter app mentioned at Try the starter app

But have trouble on generating the apk.

I just followed the instructions:

  • ✅ Clone the repository.
    git clone https://github.com/line/line-sdk-android.git
  • ❌ Build the starter app. (This step failed)
    ./gradlew app:assembleDebug

What did you expect?

I expect I can successfully build this project, and install apk to my device.

What happened actually?

Please describe what happened actually.

After executed the command:

./gradlew app:assembleDebug

I got following error messages:

> Task :line-sdk:kaptGenerateStubsDebugKotlin FAILED
e: [kapt] 'com.sun.tools.javac.util.Context' class can't be found ('tools.jar' is absent in the plugin classpath). Kapt won't work.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':line-sdk:kaptGenerateStubsDebugKotlin'.
> Compilation error. See log for more details

After executed the command with --stacktrace:

./gradlew app:assembleDebug --stacktrace

I got following error messages:

> Task :line-sdk:kaptGenerateStubsDebugKotlin FAILED
e: [kapt] 'com.sun.tools.javac.util.Context' class can't be found ('tools.jar' is absent in the plugin classpath). Kapt won't work.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':line-sdk:kaptGenerateStubsDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':line-sdk:kaptGenerateStubsDebugKotlin'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
        at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
        at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.GradleException: Compilation error. See log for more details
        at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:14)
        at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:122)
        at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:148)
        at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:143)
        at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:83)
        at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:422)
        at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:345)
        at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(Tasks.kt:306)
        at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:277)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
        at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:47)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
        at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:476)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:461)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:444)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:93)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:237)
        at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
        at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
        at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:208)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
        at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
        at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:69)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47)
        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:140)
        ... 34 more


* Get more help at https://help.gradle.org

Your environment?

  • I just cloned the latest version of this repo. The sha of commit is 9ea7dec
  • I'm using Android Studio 4.2.1
  • I'm using macOS Catalina 10.15.5
  • Have tried using Java version openjdk version "1.8.0_282", java version "15.0.1" 2020-10-20 both not working, produced the same result

Authenticate 403 Forbidden

Hello Line developers,
I am integrating login feature with Line in Android, iOS using https://github.com/xmartlabs/react-native-line
I have successfully created the Line Login channel following the instructions https://developers.line.biz/.../and.../integrate-line-login/
(my package name launched in Google Play store, my status channel login is Published)
Then I got an error 403 Forbidden from API https://access.line.me/oauth2/v2.1/authenticate (see attached image)
Can you guys help me solve it?
Thank!
395167301_2571216913039526_4652066398667964438_n

Line LoginButton LoginListener seem not call ( use Sample Code)

I use the sample code for login , but I don't get the login result from loginListener 。

@Composable
fun LineLoginButton(
    channelId: String,
    modifier: Modifier = Modifier,
    handleLoginResult: (result: LineLoginResult) -> Unit
) {
    val loginListener = object : LoginListener {
        override fun onLoginSuccess(result: LineLoginResult) {
            Log.e("我沒看到","我沒看到" $result")
            handleLoginResult(result)

        }

        override fun onLoginFailure(result: LineLoginResult?) {
            Log.e("我沒看到","我沒看到 $result")
            handleLoginResult(result ?: LineLoginResult.internalError("Unknown error"))
        }
    }

    AndroidView({ LoginButton(it) }, modifier = modifier) { loginButton ->
        // A delegate for delegating the login result to the internal login handler.
        val loginDelegate = LoginDelegate.Factory.create()

        loginButton.apply {
            setChannelId(channelId)
            setLoginDelegate(loginDelegate)
            addLoginListener(loginListener)
        }
    }
}

What did you do?

Just click login button do login 。

What did you expect?

Get result from LoginListener。

What happened actually?

LoginListener seem not be called , but it will call back from

   override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)

        // In order to receive and process the Activity Result to the `LineLoginButton`.
        handleLoginResult(resultCode, data)
    }

Your environment?

Oppo Android 11 device

就這樣 謝拉

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.