What to do after getting Auth Token - Android Youtube API


I am creating an android app, using the youtube API where you play and then favorite YouTubeVideos.I have (I think correctly) gotten the Auth Token using Account Manager and oauth2 for the user.

What I am wondering, is where to go next? I would like to create an instance of a YouTube, so that I can favorite the videos. After looking at the constructor, I do not know how to incorporate the access token into it. I have my Client_ID and Client_Secret, but all the examples I have seen have just needed that. How will the YouTube instance know who's account it is if it never takes in the Auth Token?

This is the constructor:

YouTube(HttpTransport transport, JsonFactory jsonFactory, HttpRequestInitializer httpRequestInitializer)

This is the time I made an instance of a YouTube but did not need account manager because I was only searching YouTube, not accessing any private information:

youtube = new YouTube.Builder(HTTP_TRANSPORT, JSON_FACTORY, new HttpRequestInitializer() { public void initialize(HttpRequest request) throws IOException {} }).setApplicationName("youtube-isabelle-search-sample").build(); YouTube.Search.List search = youtube.search().list("id,snippet");

Any guidance would be great! Thanks a lot!


You need to create a GoogleCredential and set this credential into this YouTube object.

For Android apps, you can use <a href="http://javadoc.google-api-java-client.googlecode.com/hg/1.12.0-beta/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.html" rel="nofollow">GoogleAccountCredential</a> to get the OAuth2 token. It stores the token inside the credential.

<a href="https://github.com/youtube/ytd-android" rel="nofollow">YouTube Direct Lite</a> Android example has a good example of using it.


  • what is related_name and related_query_name in django?
  • Exception when trying to delete a directory in Isolated Storage
  • Can't install flextable
  • What is an “illegal primary” in awk?
  • How to subset a data frame by the last day of each month
  • Build error from Installing Apache Zeppelin
  • Pix, A couple of issues I'm not understanding
  • Can't select UITableViewCell when TableView setEditing is set
  • Detect if class was defined declarative or functional - possible?
  • Use .so (Shared object) file in Android studio
  • hsqldb ignores first insert operation on table at server (server needs to be “warmed up”?)
  • Connect to database using sql server authentication programatically
  • Calculating distance between 400 cities and optimizing MySQL for it?
  • GBP pound symbol appearing as uknown char in shop
  • Repeating Texture on Model/Mesh
  • Difference between Canvas and Grid to Move, Resize, Rotate UIElements
  • sql server back restore - login failed
  • ES not listening to external requests
  • Javascript visualization package for multidimentional bar chart
  • Coin change recursive approach
  • Parsing string using the Scanner class
  • How to debug component/typescript code when running Protractor
  • Redmine can't generate secret token
  • Forward slash vs backward slash for file path in git bash
  • device tree overlay phandle
  • Can I switch the 'connected' user within an sql script that is sourced by mysql?
  • Enable CORS on Tomcat 8.0.30
  • Google Compute instance receiving email
  • Problems with special characters in php soap client
  • Issue with Terrain Collision using Three.js
  • How to make Rss News Reader application in android …? [closed]
  • Wireshark Display Filter for Unique Source/Destination IP and Protocol
  • When to use the tag in the head and body section of a html page? [duplicate]
  • Ruby regex for matching simpliest Ruby's regexes
  • Neo4j…how to get a visual representation of my data?
  • Support of :after in IE7
  • Cloud Code: Creating a Parse.File from URL
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • Apple Mach-O Linker error (“duplicate symbol”)
  • Access to a Matlab gui from the web