请求未授权Youtube直播Android

时间:2017-03-31 14:02:00

标签: android youtube-api android-youtube-api youtube-data-api

在OAoutClient Credential的Youtube直播中。我得到了“请求未授权”。我在google api控制台中创建了新凭据。但我收到此错误谢谢提前帮助。

     GoogleJsonResponseException code: 403 : Request is not authorized
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err: {
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:   "code": 403,
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:   "errors": [
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     {
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:       "domain": "youtube.liveBroadcast",
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:       "message": "Request is not authorized",
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:       "reason": "insufficientLivePermissions",
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:       "extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/insert#auth_required"
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     }
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:   ],
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:   "message": "Request is not authorized"
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err: }
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1056)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.android.apps.watchme.util.YouTubeApi.createLiveEvent(YouTubeApi.java:95)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.android.apps.watchme.StartActivity$CreateLiveEventTask.doInBackground(StartActivity.java:326)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at com.google.android.apps.watchme.StartActivity$CreateLiveEventTask.doInBackground(StartActivity.java:309)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:288)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-31 19:28:48.531 19284-19810/com.ephron.mobilizerapp W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
03-31 19:28:48.536 19284-19810/com.ephron.mobilizerapp W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-31 19:28:48.536 19284-19810/com.ephron.mobilizerapp W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-31 19:28:48.536 19284-19810/com.ephron.mobilizerapp W/System.err:     at java.lang.Thread.run(Thread.java:841)

1 个答案:

答案 0 :(得分:0)

首先,请确保您在开发者控制台中启用了YouTube数据API。

错误 403或“请求未经授权”是基于此documentation的YouTube API授权问题。因此,请确保在实施OAuth 2.0身份验证时正确遵循指南here。还要确保使用所有必要的范围。

我建议您先尝试通过此try it part运行您的请求,以验证授权部分中是否存在问题。

希望这些信息对您有所帮助。