Search code examples
gdataauthsub

Authorizing localhost with gdata and AuthSub?


While testing I started walking through authorizing my test machine (192.168.15.6, a local IP) with YouTube, which seemed successful. That IP is listed under my authorized sites. However, any actual requests say I'm not authenticated. I'm guessing it isn't going to work because the requests seem to be coming from my Public IP, right?


Solution

  • The documentation is split up between the API reference, the gdata guide, and the python client guide. The examples seem limited. I didn't get, from the Python guide, that the session token is a new token, rather than an upgrade of the existing one-use token.

    yt_service.SetAuthSubToken(token)
    yt_service.UpgradeToSessionToken()
    session_token = yt_service.current_token.get_token_string()
    

    This gives you the new token after upgrading for a session.