youtube: provide functionality for generating credentials JSON file for youtube API access to an account

Issue #106 resolved
Saxon Milton created an issue

This is a sub-issue to issue #105.

For the YouTube API to access a users account, credentials are required. Google’s most popular authorisation option as of today seems to be oauth 2.0 (see [here](https://developers.google.com/youtube/registering_an_application) about YouTube API auth). In this form, the application prompts the user with a google account log in window with which the user can use to select the google account that will accept control from the application. Through this process, tokens are generated that can be used by the application to gain access. One of which is temporary, and another (refresh token) which can be used to gain access without further prompts. These tokens are generally stored as a JSON file, whether that be on the users computer, or in the corresponding storage for a web app.

Ideally, the web app i.e. vidgrind, would check for a credentials JSON file corresponding to the specified youtube account and use this for authorisation, otherwise, the application will prompt the user to log in to the desired account, generate a credentials file and store this for latter usage.

It’s suggested this functionality be modelled closely on the following sample code from the official YouTube API go code samples. This code is different to the desired implementation in that a local web server is used, and and credentials are stored on the local machine. We will need to run this on our web service vidgrind and have credentials stored in ausocean’s storage bucket.

Comments (3)

  1. Saxon Milton reporter

    After testing on GAE, some corrections need to be made, namely:
    1) modification of googlestorageAddr to return path of gs bucket URI without “/” at start.
    2) use of new ctx value for gs bucket handling
    3) return obj in getObject for writing to if not exist
    4) close of object writer after encoding token

  2. Log in to comment