Google Drive API : login programmatically

2019-04-07 19:39发布

问题:

I am developing application which is required to upload file into Google Drive. I started learning API from following link. https://developers.google.com/drive/ios/quickstart

Currently,I have to login first time for upload file. But in my application, every time there is same account will be used for uploading file. So, is there any way by which I can bypass GTMOAuth2ViewControllerTouch (login screen).

Please help me. I will be very thankful for your replay.

回答1:

Most Google APIs currently require an OAuth 2 token, and so far that is available only via the user-directed sign-in flow, which is what gtm-oauth2 provides.Some older Google APIs do support the ClientLogin protocol, in which the username and password are supplied directly by the application, but the newer APIs do not.

Remember that hardcoding any account authorization(especially an account password) into an application's binary is a security risk and is poor practice.