Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - youtube api r52 - "access not configured"
    text
    copied!<p>I am building a simple test android app, where I am trying to get data about a particular video. I have taken the SHA1 fingerprint of my debug keystore and created a google api key with it (and my package name). I have activated the youtube api service for it.</p> <p>This is my code:</p> <pre><code>YouTube youtube = new YouTube.Builder(new NetHttpTransport(), new GsonFactory(), new HttpRequestInitializer() { public void initialize(HttpRequest request) throws IOException {} }).setApplicationName("MyApp").build(); try { YouTube.Videos.List listVideosRequest = youtube.videos().list("snippet,contentDetails"); listVideosRequest.setId("A3PDXmYoF5U"); listVideosRequest.setKey(GoogleAPIKey.DEBUG_GOOGLE_API_KEY); VideoListResponse youtubeResponse = listVideosRequest.execute(); List&lt;Video&gt; youtubeVideos = youtubeResponse.getItems(); return youtubeVideos; } catch (IOException e) { Log.e("MyApp", e.getLocalizedMessage()); return null; } </code></pre> <p>So, i always get an exception: 403, Access not configured.</p> <p>I am running out of ideas, what could be wrong. Anyone have successfully used the youtube api for android yet with an api key?</p> <p><strong>Update:</strong></p> <p>I just deeply debugged the google libraries in order to find, what the actual request looks like, that is sent to google. It is this:</p> <pre><code>https://www.googleapis.com/youtube/v3/videos?id=A3PDXmYoF5U&amp;key=[my-debug-google-api-key]&amp;part=snippet,contentDetails </code></pre> <p>with these headers set:</p> <pre><code>Accept-Encoding: gzip User-Agent: MyApp Google-HTTP-Java-Client/1.15.0-rc (gzip) </code></pre> <p>I don't see anything wrong there.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload