2017-03-31 103 views
0

在Youtube直播在OAuthClient憑證。我得到了「請求未授權」。我在google api控制檯中創建新的憑據。但我得到了這個錯誤,感謝提前幫助。請求未授權Youtube直播Android

 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) 

回答

0

首先,確保您在Developer Console中啓用了YouTube數據API。

錯誤403或「請求未被授權」是基於此documentation的YouTube API授權問題。因此,請確保您在實施OAuth 2.0身份驗證時正確遵循指南here。還要確保你使用了所有必要的範圍。

我建議您先嚐試通過此try it part來運行您的請求,以驗證授權部分中是否存在問題。

希望這些信息對您有所幫助。