Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

While integrating Keyclock SDK , I try to exchange authorization code to access token

authService.performTokenRequest(
resp.createTokenExchangeRequest(),
new AuthorizationService.TokenResponseCallback() {
  @Override public void onTokenRequestCompleted(
        TokenResponse resp, AuthorizationException ex) {
      if (resp != null) {
        // exchange succeeded
      } else {
        // authorization failed, check ex for more details
      }
    }
});

I got the following error,

  java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:354)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
    at java.util.concurrent.FutureTask.run(FutureTask.java:271)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:764)
 Caused by: java.lang.IllegalArgumentException: only https connections are permitted
    at net.openid.appauth.Preconditions.checkArgument(Preconditions.java:116)
    at net.openid.appauth.connectivity.DefaultConnectionBuilder.openConnection(DefaultConnectionBuilder.java:51)
    at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:418)
    at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:395)
    at android.os.AsyncTask$2.call(AsyncTask.java:333)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
770 views
Welcome To Ask or Share your Answers For Others

1 Answer

The log is almost clear

only https connections are permitted

I think your answer is here:

Android 8: Cleartext HTTP traffic not permitted

update:

after I look at the Github repository I find this error in issues

Error: only https connections are permitted


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...