YouTube API:com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden

YouTube API : com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden(YouTube API:com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden)
本文介绍了YouTube API:com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 YouTube API 的新手.我已经在我的 Eclipse 中从 github 下载并导入了 yt-direct-lite youtube android 项目.一切都好.但是,当我运行该项目时,它会吐司/弹出错误消息:

I am new to YouTube APIs. I have downloaded and imported yt-direct-lite youtube android project from github in my eclipse. Everything is fine. But, when I run the project it toast/pops up error message that :

[错误] 未配置访问权限:未为您的项目启用 API(youtube 数据 API).请使用谷歌开发者控制台更新您的配置.

[Error] Access not configured: The API (youTube Data API) is not enabled for your project. Please use google developer console to update your configuration.

不过,我已经开启了 Google+ API 以及 YouTube Data API v3.

However, I have already turned on Google+ API as well as YouTube Data API v3.

另外,我已经生成了 API 密钥.一切都很好,但是当它在项目中登录 Google/Gmail 帐户时.此外,在异常情况下触发.

Also, I have generated API key. All the things are fine but when it goes to sign in for Google/Gmail account in the project. Also, fires below exception.

02-04 15:06:38.553: E/TetsProject(8413): Error
02-04 15:06:38.553: E/TetsProject(8413): com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
02-04 15:06:38.553: E/TetsProject(8413): {
02-04 15:06:38.553: E/TetsProject(8413):   "code": 403,
02-04 15:06:38.553: E/TetsProject(8413):   "errors": [
02-04 15:06:38.553: E/TetsProject(8413):     {
02-04 15:06:38.553: E/TetsProject(8413):       "domain": "usageLimits",
02-04 15:06:38.553: E/TetsProject(8413):       "message": "Access Not Configured. The API (YouTube Data API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
02-04 15:06:38.553: E/TetsProject(8413):       "reason": "accessNotConfigured",
02-04 15:06:38.553: E/TetsProject(8413):       "extendedHelp": "https://console.developers.google.com"
02-04 15:06:38.553: E/TetsProject(8413):     }
02-04 15:06:38.553: E/TetsProject(8413):   ],
02-04 15:06:38.553: E/TetsProject(8413):   "message": "Access Not Configured. The API (YouTube Data API) is not enabled for your project. Please use the Google Developers Console to update your configuration."
02-04 15:06:38.553: E/TetsProject(8413): }
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1049)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.ytdl.MainActivity$3.doInBackground(MainActivity.java:417)
02-04 15:06:38.553: E/TetsProject(8413):    at com.google.ytdl.MainActivity$3.doInBackground(MainActivity.java:1)
02-04 15:06:38.553: E/TetsProject(8413):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-04 15:06:38.553: E/TetsProject(8413):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-04 15:06:38.553: E/TetsProject(8413):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
02-04 15:06:38.553: E/TetsProject(8413):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-04 15:06:38.553: E/TetsProject(8413):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-04 15:06:38.553: E/TetsProject(8413):    at java.lang.Thread.run(Thread.java:856)
02-04 15:06:38.633: I/brcm-gr(8413): [gralloc_lock]: new usage 0x933

不知道有什么问题?

推荐答案

我将 Android Key 替换为 Browser key.它帮助了我现在可以使用了.

I replaced Android Key by Browser key. It helped me & works now.

这篇关于YouTube API:com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)