Google Drive Api authentication in Android app -


i using google drive in android app application takes photos , uploads drive automatically, problem authentication asks choose google account first time when open app ,can programatically give credentials , make authentication done can avoid step of choosing , authentication ui.

you may refer link. can done oauth2 playground @ https://developers.google.com/oauthplayground.

steps:-

  1. create google account (eg. my.drive.app@gmail.com)
  2. use api console register mydriveapp (https://console.developers.google.com/apis/credentials/oauthclient?project=mydriveapp or https://console.developers.google.com/apis/)
  3. create new set of credentials (nb oauth client id not service account key , choose "web application" selection)
  4. include https://developers.google.com/oauthplayground valid redirect uri
  5. note client id (web app) , client secret
  6. login my.drive.app@gmail.com
  7. go oauth2 playground
  8. in settings (gear icon), set * oauth flow: server * access type: offline * use own oauth credentials: tick * client id , client secret: step 5
  9. click step 1 , choose drive api https://www.googleapis.com/auth/drive (having said that, technique works of google apis listed)
  10. click authorize apis. prompted choose google account , confirm access
  11. click step 2 , "exchange authorization code tokens"
  12. copy returned refresh token , paste app, source code or in form of storage app can retrieve it.

you may use service account. however, create pseudo drive account app, rather allow app access regular drive account. check this.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -