Comments (6)
I'm not sure why you are running into a timeout, but you can increase the timeout length using the code listed here:
https://developers.google.com/api-client-library/java/google-api-java-client/errors#timeouts
from java-samples.
Link is showing to add timeout in HttpRequestInitializer.
Google API for mail uses Credential class and implements HttpRequestInitializer. and Lines that I marked as yellow are not able to execute because I am getting Credential as null.
Here, this time out will come in picture only after authorise() method completes. But in my case, I am getting time out on line "TokenResponse response = flow.newTokenRequest(code).setRedirectUri(redirectUri).execute();". This line redirects me to url as below: "http://localhost:25745/Callback?code=4/AABrLErTmOxzKEqqD31iiMftE93i3k06oJ4sAI34uS7jI7U-VAdofx0hV8ZoyzHEJyjFEx6x1VYASMNe779Dpa0#"
And this is where exact problem lies and I am not able to execute "return flow.createAndStoreCredential(response, userId);" line. I think If I get TokenResponse, Token will be stored as a file and it should work.
from java-samples.
I see, the timeout there is for the service itself, but this is happening earlier with the OAuth flow. Some more searching indicates this is a proxy issue. Please try the recommended solution here:
https://stackoverflow.com/a/39347143
from java-samples.
I consulted network team for proxy related details but in our environment proxy is not configured.
I have debugged further into timeout issue and finding are as below:
API is trying to execute redirect url with code and get authentication Token.
When I debugged I got redirect urls as :
http://localhost:37946/Callback with code appended as specified above
I stopped before executing redirect request in debugging and got a snapshot of TCP View as below:
As one can see, there is port opened but Client API is not able to connect to this port and gives time out error.
from java-samples.
Looking at the stack trace you posted earlier, the timeout is happening when the code tries to make a request to Google's OAuth2 https://www.googleapis.com/oauth2/v4/token
endpoint, not with the callback URL. See if you can make a request to that URL in your Java environment using other means.
from java-samples.
Closing due to inactivity.
from java-samples.
Related Issues (20)
- Unable to set permissions for Windows File System HOT 1
- java.net.SocketException: Connection reset HOT 2
- Alert Center API Error: 401 Unauthorised
- 'compile' configuration introduced by the Java plugin have been deprecated since Gradle 4.10 HOT 2
- Dependency Dashboard
- Fix Typos in GmailQuickstart class comment
- Google Drive Class does not have drives API for shared drive management HOT 1
- Gmail API Java Quickstart Exception checkArgument(Preconditions.java:131) HOT 4
- Execution failed for task ':compileJava'. > warning: source release 18 requires target release 18
- Gmail API Cyrillic Support
- [SyncRepoSettings bot] - Invalid config file
- MyBusinessAPIs without user prompt HOT 1
- Google Drive Private File upload(config.json) HOT 2
- Java quickstart for Google Drive: java.net.BindException: Address already in use: bind HOT 1
- J
- Deleting a message gives GoogleJsonResponseException: Request had insufficient authentication scopes.
- tokens should be cleaned out by gradle at will HOT 1
- No export links available for google form and google map HOT 2
- In Sheets API - BatchUpdateValues should be able to update multiple ranges at a time.
- DOCUMENT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-samples.