Login To A Specific Google Drive Account Through Code
Is it possible to login into a google account from an android device through code? The reason i'm asking is this: I want to use google drive to store the contents for an app, and t
Solution 1:
Username/password, aka basic authorization is not supported. You need to go through OAuth 2.0 flow. GoogleAccountCredential intent does much of the work for you. See the Android quickstart sample.
If you don't want user interaction and want to create a Google Drive account for your app to serve files, you may embed an encrypted access token and a refresh token into your application and init a credential object with the embedded tokens. Please review security concerns before taking such a decision:
Credentialcredential=newGoogleCredential.Builder()
.setClientSecrets("...")
....
.build();
credential.setAccessToken(storedAccessToken);
credential.setRefreshToken(storedRefreshToken)
Post a Comment for "Login To A Specific Google Drive Account Through Code"