user1629785
user1629785

Reputation: 21

Google Drive API Authentication in Backend in java

I am using google drive api for desktop application to insert a file .To authenticate google drive i am using url that it generates and get Authentication code and paste it back in front end.

Plz suggest some other way such a way that it authenticates in the backend and uploads a file automatically.

Upvotes: 0

Views: 1213

Answers (1)

Jay Lee
Jay Lee

Reputation: 13528

You can cut out the copy-paste work for the user by implementing a webserver in Java that listens to a port on the localhost, something like http://localhost:8181. You would then use that URL as the redirect_uri parameter when requesting the refresh token. If your application also automatically opens the refresh token request page for the user then the authorization workflow should be relatively simple and straightforward for the user.

If you really want zero user interaction, you'll need to use Service Accounts and have the service account delegated domain-wide authority to user's Google Drives:

Upvotes: 1

Related Questions