I implemented a remote connection to Google Drive in my iOS application using the Google Drive SDK.
I can successfully access lists of files and folders and metadata using the GTLServiceDrive class and load content using the GTMHTTPFetcher class.
When I download content using the GTMHTTPFetcher class, I use the GTLServiceDrive downloadUrl key, and I use the line of code to authorize the download - for the second line of code following ...
GTMHTTPFetcher *fetcher = [googleDriveService.fetcherService fetcherWithURLString: << downloadUrl >>]; [fetcher setAuthorizer:googleDriveService.authorizer];
where googleDriveService is an instance of the GTLServiceDrive class.
For certain files located on Google Drive, I have an application for my application that is selected from two options: whether they want to download a copy to save on the device or just save the link using the GTLServiceDrive webContentLink and access the content on demand (without downloading and save to documents or caches).
For this second parameter, I would like my application to present the file in a UIWebView .
It works with almost the following code ...
...other code to prepare UIWebView... NSURLRequest *request = [NSURLRequest requestWithURL: << webContentLink >>]; [webView loadRequest:request];
Downloading the web view, however, is an OAuth login page, I think because the loadRequest: method requests access to the private file without permission.
I celebrate ...
- that I already installed the OAuth keyword element during the initial connection (installation process) to retrieve the lists and metadata in the folder and files.
- that after I log in a second time using this second OAuth view controller, this login will be saved (not required again), including after turning off and rebooting the device.
Perhaps a second keychain element has been added?
Is there any method that I can use, like the GTMHTTPFetcher class with the authorize property, to allow me to submit a Google Drive file to UIWebView , but not ask the user to execute a second login, although they only need to make this second login once?