0

I am writing a java desktop application for a single user that needs to access files in Google Drive in one specific google account which I want to hard code into the application. I am very confused about this whole OAuth 2.0 business which I am not familiar with it. Is there a simple way to login to the google apis when the user is known in advance?

1 Answer 1

2

You can have a look at the scribe library, this should make your life easier.

https://stackoverflow.com/tags/scribe/info

https://github.com/fernandezpablo85/scribe-java

Scribe provides an easy, extensible and bug-free way of OAuth-signing requests. But you have to check about their support for oauth 2.0: "OAuth 2.0 support is not going to get any more attention and may eventually be deprecated and dropped." But there are several forks to support Google OAuth 2.0

https://github.com/Kobee1203/scribe-java

https://github.com/bistri/scribe-java/

Sign up to request clarification or add additional context in comments.

2 Comments

This helped a lot and I managed to get it to login, but now I can't figure out how to interface with the google drive api. Is there a way to use Scribe without having to write all of the http requests yourself?
You can do something like: OAuthRequest request = new OAuthRequest(Verb.GET, "graph.facebook.com/me"); //if you have parameters to pass use: addOAuthParameter("key", "value"); getOAuthService().signRequest(accessToken, request); Response response = request.send();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.