I am new to YouTube APIs. I have done create and fetch live events on YouTube. But I'm trying to start live events from my app I'm getting this error:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
POST https://www.googleapis.com/youtube/v3/liveBroadcasts/transition?broadcastStatus=live&id=m0BCwKmG9Ws&key=AIzaSyCRiIM7Tdb_rqFcGSbQ0jXy0GeODCNSq4g&part=status
{
"code": 403,
"errors": [
{
"domain": "youtube.liveBroadcast",
"message": "Stream is inactive",
"reason": "errorStreamInactive",
"extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/transition"
}
],
"message": "Stream is inactive"
}
Code for go-live
fun startEvent(youtube: YouTube, broadcastId: String?) {
val transitionRequest = youtube.liveBroadcasts().transition(
"live", broadcastId, "status"
)
transitionRequest.key = context.getString(R.string.api_key)
transitionRequest.execute()
}
I also tried this but still getting the same issue.
I don't know what's wrong with it?
As per the official specification of the LiveBroadcasts.transition API endpoint:
Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active.
The error specification reads as follows:
forbidden (403) errorStreamInactive
The requested transition is not allowed when the stream that is bound to the broadcast is inactive.
Hence, unequivocally, your live stream that's bound to your live broadcast must be active prior to invoking LiveBroadcasts.transition.
This error will be resolved by enabling autostart while creating a live event
val contentDetails = LiveBroadcastContentDetails()
contentDetails.set("enableAutoStart", true)
Related
Android Firebase Google signin through authorization error when google return token id. i have both cleint id as well as web sdk key saved on firebase. Even json file.
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if (!task.isSuccessful()) {
Log.w(TAG, "signInWithCredential", task.getException());
Toast.makeText(OnBoarding.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
// ...
}
});
Got this error
com.google.firebase.FirebaseException: An internal error has occured. [ Bad Request ]
at com.google.android.gms.internal.zzacq.zzbN(Unknown Source)
at com.google.android.gms.internal.zzacn$zzg.zza(Unknown Source)
at com.google.android.gms.internal.zzacy.zzbO(Unknown Source)
at com.google.android.gms.internal.zzacy$zza.onFailure(Unknown Source)
at com.google.android.gms.internal.zzact$zza.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:565)
Though google signIn went well there is something missing with firebase which m not able to figure out need help
Logs
"error": {
"errors": [{
"domain": "usageLimits",
"reason": "keyExpired",
"message": "Bad Request"
}],
"code": 400,
"message": "Bad Request"
}
}
In the firebase console (Overview) Under Your mobile apps click the overflow button (three vertical dots) and goto Manage.
Once there goto your app and download the google-services.json
Add that to the root directory of your app and also to the /app folder.
This worked for me to fix this exact error. I assume I changed something at some point and needed a new one.
Hopefully this helps. Goodluck
Some reason to get [ Bad Request ].
Error Conditions:
The Firebase REST API will return error codes under these circumstances.
1) 404 Not Found : A request made over HTTP instead of HTTPS
2) 400 Bad Request : Unable to parse PUT or POST data
3) 400 Bad Request : Missing PUT or POST data
4) 400 Bad Request : Attempting to PUT or POST data which is too large
5) 417 Expectation Failed : A REST API call that doesn't specify a Firebase name
6) 400 Bad Request : A REST API call that contains invalid child names as part of the path
7) 403 Forbidden : A request that violates your Security and Firebase Rules
Check which type of parameter or other things are missing in request as per above option.
I hope its helps you.
I'm using google REST Api to retrieve list of spreadsheets.
Everything works when it is accessed by my account.
But when I try to use foreign account, I'm getting this error:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden {
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "The caller does not have permission",
"reason" : "forbidden"
} ],
"message" : "The caller does not have permission",
"status" : "PERMISSION_DENIED"
}
It says I have no access to my google script, but the script is set as visible and shared for anyone.
Code:
private Object getDataFromApi(ExecutionRequest request)
throws IOException
{
if (BuildConfig.DEBUG) {
request.setDevMode(true); // it will take saved version of script and not the published one
}
// Make the request.
Operation op =
mService.scripts().run(SCRIPT_ID, request).execute();
Change the SCOPE from SheetsScopes.SPREADSHEETS_READONLY to SheetsScopes.SPREADSHEETS.
private static final List SCOPES = Arrays.asList(SheetsScopes.SPREADSHEETS);
I found the problem was in code:
if (BuildConfig.DEBUG) {
request.setDevMode(true); // it will take saved version of script and not the published one
}
It looks like it alway force to access saved version and not the published. Then the foreign account had no access to saved version and returns error 403.
When I disable this dev mode or install release version, then everything is ok.
I am trying to use the Google Health API with a REST API. I am aware there is an API available for Android but I am trying to port that behavior to a back end.
I am playing around in the Oauth playground; I am trying to get a aggregated query. I've tried many things but none of them return anything (only get errors) There is no example featured on the google website itself. Anyone has experience with this API?
I have found a few examples here on stackoverflow but none of them conclude with a solution or a full query that can fit as an example.
Here and Here
If I just could get a working aggregate example I would work from there.
Here is my request to https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate:
{
"startTimeMillis": 1451647796000,
"endTimeMillis": 1458127796000,
"aggregateBy": [
{
"dataTypeName": "com.google.height"
}
],"bucketByTime": {
"period": {
"type": "day",
"value": 1,
"timeZoneId": "org.joda.timezone.DateTimeZone"
}
}
}
Response:
{
"error": {
"code": 400,
"message": "Bad Request",
"errors": [
{
"domain": "global",
"message": "Bad Request",
"reason": "invalidArgument"
}
]
}
}
You forgotten "durationMillis" field on "bucketByTime" and "dataSourceId" on "aggregateBy".
Timezone syntax is like "America/Los_Angeles" not "org.joda.timezone.DateTimeZone". You can see this strings on http://joda-time.sourceforge.net/timezones.html
Trying to use IO Keen for Android, i'm using Android Sample available here (https://github.com/keenlabs/KeenClient-Android-Sample) the data is being sent, but they are always duplicate and the second always contains junk.
The HashMap event is clean before adding in the queue.
Am I the only one?
Watch these :
{
"keen": {
"timestamp": "2015-01-22T18:08:49.863Z",
"created_at": "2015-01-22T18:09:07.589Z",
"id": "54c13cc3672e6c486c7a28bb"
},
"click-number": 0
}
{
"keen": {
"timestamp": "2015-01-22T18:09:07.590Z",
"created_at": "2015-01-22T18:09:07.590Z",
"id": "54c13cc3672e6c486c7a28bc"
},
"-537732783": 3
}
"-537732783": 3 What is that?
Logcat :
FINER: Sent request '{"android-sample-button-clicks":[{"click-number":0,"keen":{"timestamp":"2015-01-22T13:14:19.075-0500"}}]}' to URL 'https://api.keen.io [...]
FINER: Received response: '{"android-sample-button-clicks": [{"success": true}]}' (200)
FINER: Sent request '{"android-sample-button-clicks":[{"-1236199318":1}]}' to URL 'https://api.keen.io [...]
FINER: Received response: '{"android-sample-button-clicks": [{"success": true}]}' (200)
This was caused by a bug in the 2.1.0 release of the SDK. It has been fixed in the 2.1.1 release.
(In more detail: the bug was in the retry limiting logic that was added as part of 2.1. See this PR for the fix: https://github.com/keenlabs/KeenClient-Java/pull/37)
Sorry for the mistake!
I want to show the profile picture using the graph api using the following link fpor example :
https://graph.facebook.com/me/picture?redirect=0&height=200&type=normal&width=200
I get the response :
{
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500
}
}
Where in the link they say
Because profile pictures are always public on Facebook, this call does
not require any access token.
The me in the URI is just a placeholder, you need to put an actual Facebook user-id in, like the title (/{user-id}/picture) of your linked page suggests.
For example:
https://graph.facebook.com/snoopdogg/picture?redirect=0&height=200&type=normal&width=200
...returns the following:
{
"data": {
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c11.0.433.433/s200x200/598452_10151897536239807_882122819_n.jpg",
"width": 200,
"height": 200,
"is_silhouette": false
}
}