问题
I am trying to fetch video details using YouTube Data API v3 in my android app. Now I am getting the following error even though I am using an API Key. How can I resolve it?
06-19 17:50:58.280: E/There was a service error:(16968): com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
06-19 17:50:58.280: E/There was a service error:(16968): {
06-19 17:50:58.280: E/There was a service error:(16968): "code" : 403,
06-19 17:50:58.280: E/There was a service error:(16968): "errors" : [ {
06-19 17:50:58.280: E/There was a service error:(16968): "domain" : "usageLimits",
06-19 17:50:58.280: E/There was a service error:(16968): "message" : "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
06-19 17:50:58.280: E/There was a service error:(16968): "reason" : "dailyLimitExceededUnreg",
06-19 17:50:58.280: E/There was a service error:(16968): "extendedHelp" : "https://code.google.com/apis/console"
06-19 17:50:58.280: E/There was a service error:(16968): } ],
06-19 17:50:58.280: E/There was a service error:(16968): "message" : "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
06-19 17:50:58.280: E/There was a service error:(16968): }
回答1:
Try to set api key on your query. It may resolve your problem. ex:
YouTube.Videos.List listVideosRequest = youtube.videos().list("snippet").setId(videoId);
listVideosRequest.setKey(apiKey);
VideoListResponse listResponse = listVideosRequest.execute();
回答2:
This issue seems to be due to not verified OAuth consent sreen by Google. They sometimes take a very long time to verify them and if your app is very popular, it reaches the Daily Limit for Unauthenticated Use rather quickly. So, there isn't much you can do other than contacting Google Trust & Safety team to expedite verification.
来源:https://stackoverflow.com/questions/24306611/daily-limit-for-unauthenticated-use-exceeded-continued-use-requires-signup