title: com.google.android.gms.auth.GoogleAuthException: UNREGISTERED_ON_API_CONSOLE
body: <p>Im implementing an android app that enables users to stream to a youtube channel straight from the app. I have created an API key and a OAuth 2.0 client ID <a href="https://i.stack.imgur.com/3CVJ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3CVJ8.png" alt="enter image description here" /></a></p>
  <p>But I get a the following exeption: <code>com.google.android.gms.auth.GoogleAuthException: UNREGISTERED_ON_API_CONSOLE</code> either when I try to ceate an event or when i try to fetch the one a created manually on the youtube channel.</p>
  <p>I use the following code for create a youtube object</p>
  <pre><code>String accountName = mContext.getString(R.string.google_account_name);
          String apiKey = mContext.getString(R.string.google_api_key);
          String clientID = mContext.getString(R.string.google_api_client_id);
          String clientName = mContext.getString(R.string.google_api_client_name);
  
          GoogleAccountCredential credential =
                  GoogleAccountCredential.usingOAuth2(mContext,
                          Arrays.asList(YouTubeScopes.YOUTUBE));
          credential.setSelectedAccountName(accountName);
  
  //        String SCOPE = &quot;audience:server:client_id:&quot; + clientID + &quot;:api_scope:&quot; + YouTubeScopes.YOUTUBE;
  //        GoogleAccountCredential credential = GoogleAccountCredential.usingAudience(mContext, SCOPE);
  //        credential.setSelectedAccountName(accountName);
  
  
          youtube = new YouTube.Builder(transport, jsonFactory, credential)
                  .setApplicationName(clientName)
                  .setYouTubeRequestInitializer(new YouTubeRequestInitializer(apiKey))
                  /*.setGoogleClientRequestInitializer(new YouTubeRequestInitializer(apiKey))*/
                  .build();
  </code></pre>
  <p>Then to create an event:</p>
  <pre class="lang-java prettyprint-override"><code>LiveBroadcastSnippet broadcastSnippet = new LiveBroadcastSnippet();
  broadcastSnippet.setTitle(name);
  broadcastSnippet.setScheduledStartTime(new DateTime(futureDate));
  
  LiveBroadcastContentDetails contentDetails = new LiveBroadcastContentDetails();
  MonitorStreamInfo monitorStream = new MonitorStreamInfo();
  monitorStream.setEnableMonitorStream(false);
  contentDetails.setMonitorStream(monitorStream);
  
  // Create LiveBroadcastStatus with privacy status.
  LiveBroadcastStatus status = new LiveBroadcastStatus();
  status.setPrivacyStatus(&quot;unlisted&quot;);
  
  LiveBroadcast broadcast = new LiveBroadcast();
  broadcast.setKind(&quot;youtube#liveBroadcast&quot;);
  broadcast.setSnippet(broadcastSnippet);
  broadcast.setStatus(status);
  broadcast.setContentDetails(contentDetails);
  
  // Create the insert request
  YouTube.LiveBroadcasts.Insert liveBroadcastInsert = youtube
          .liveBroadcasts().insert(&quot;snippet,status,contentDetails&quot;,
                              broadcast);
      
  // Request is executed and inserted broadcast is returned
  LiveBroadcast returnedBroadcast = liveBroadcastInsert.execute(); //&lt;= This line generates the exception
  </code></pre>
  <p>I obviously did something wrong, but I can't figure out what. Any help is appreciated. Thanks in advance</p>