question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File not found exception when requesting token

See original GitHub issue

I am using the google app auth example. I modified the urls as per my oauth provider. I have specified the a valid authorization endpoint, client id, redirect uri, token uri, scope(openid, profile, email), response type (Code). I don’t know if there is a way to add consumer secret. I have not seen anywhere in the sample code a way to add consumer secret. When I run the app, I see our sso page, I am able to login, redirect happens. When the request to get token gets executed, I get an exception. The token request is failing. Any idea why this would happen? The token exchange url is correct and I am not sure why it is complaining about file not being found at that particular token url. Any pointers on digging more into this issue?

W/AppAuthSample: Token Exchange failed
    AuthorizationException: {"type":0,"code":3,"errorDescription":"Network error"}
        at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:244)
        at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:206)
        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:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.io.FileNotFoundException: <token_url>
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:251)
        at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
        at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:26)
        at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:239)
        at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:206) 
        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:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Johnnie843commented, Feb 22, 2019

Im getting the same error but I’m using my own keycloak server. I get the SSO login screen but when it does the callback I get:

06-17 02:15:42.500 26098-26098/com.google.codelabs.appauth W/AppAuthSample: Token Exchange failed AuthorizationException: {“type”:0,“code”:3,“errorDescription”:“Network error”} at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:244) at net.openid.appauth.AuthorizationService$TokenRequestTask.doInBackground(AuthorizationService.java:206) at android.os.AsyncTask$2.call(AsyncTask.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)

I check the Auth and Token URI and they are correct and on the keycloak server I see I have active session with my login.

0reactions
essieMcommented, Apr 5, 2020

@Johnnie843 were you able to resolve this issue? I’m also getting the same error with my Keycloak server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileNotFoundException when trying to get acess token of ...
In my case it worked after making Enforce signed requests unchecked. you can find this option under Security.
Read more >
How to Fix the FileNotFoundException in Java.io - Rollbar
The FileNotFoundException is a checked exception in Java that occurs when an attempt to open a file denoted by a specified pathname fails....
Read more >
Synapse Notebook FileNotFoundException when linked ...
When the linked service is configured with account key, it returns a SAS token as connection string that can be passed in through...
Read more >
Resolve errors | Drive API - Google Developers
To fix this error, instruct the user to contact the file's owner and request edit access. You can also check user access levels...
Read more >
Okta API Error Codes - Okta Developer
API call exceeded rate limit due to too many requests. Show Example Error Response. E0000048: OPP entity not found exception. HTTP Status ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found