How to manage Youtube API v3 resumable upload that last more than one hour - api

So the problem I'm facing is uploading large video files trough Youtube API v3.0.
I'm folowing the steps specified here.
So I thought that the issue lies in access token, becouse it's valid only for 3600 seconds. So I got the refresh token from OAuth Playground. And I get the fresh token when user starts the upload on my Youtube channel. After 50 minutes i abort the PUT request, get the fresh token and resume upload like specified in documentation. The problem is that after one hour I get response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
Everything works fine when upload lasts less than one hour. But when uploading big files on slow broadband the upload fails. What am I doing wrong?
I'm making the requests in JavaScript with jQuery. I double checked the steps in documentation, and if it works with smaller video i think the script is ok.
Even this script fails to upload after one hour, the progress bar comes to 100% but then it gets 401 response.
Thank you for your time, and sorry for my bad english.

Related

Production environment getting error 401 (Code: 701 - Wrong authentication credentials) when calling any amadeus api endpoint

Using the Postman collection for Amadeus for Developers I can successfully get access token and execute any api endpoint in the test environment (test.api.amadeus.com)
But after signing up successfully for Production Environment (without Flight Create Offer), I am able to get access token from Production (api.amadeus.com) BUT all api endpoint execution results in 401 error (Code: 701 - Wrong authentication credentials)
Below is the error in postman
{
"errors": [
{
"status": 401,
"code": 701,
"title": "Wrong authentication credentials.",
"source": {
"pointer": "uri"
}
}
]
}
i have made sure the bearer token is valid and my api calls are pointed to api.amadeus.com using the Prodction Key and Secret.
I have been in contact with Amadeus email helpline (self-service.apis#amadeus.com) for the last 3 weeks, and after each week they instructed me to reset my account password and wait 2 hours before making the call, which i did three times now and ended up with the same error.
I hope someone higher in the tech department will notice my question and will be able to shed some light as to why your system is not letting me call production environment.
will be eagerly waiting for some advise.....
Happened to me as well, try to generate an access token few more times and use it, for me is suddenly worked

My working Foursquare api stopped working, failing consumer disabled [duplicate]

I recently started using the foursquare API, but suddenly I get "Consumer disabled" error responses.
So far, the only API call I've been doing is one to browse some venues:
https://api.foursquare.com/v2/venues/search?ll=51.222816,3.224778&query=Friet&radius=200&limit=10&categoryId=4d4b7105d754a06374d81259&client_id=app_id&client_secret=app_secret&v=20161116
These are the parameters I am sending:
ll:51.222816,3.224778
query:Friet
radius:200
limit:10
categoryId:4d4b7105d754a06374d81259
client_id:app_id
client_secret:app_secret
v:20161116
At first everything went well, then I started working on some other part and now I'm back to foursquare and getting the following response (with 403 http status code):
{
"meta": {
"code": 403,
"errorType": "not_authorized",
"errorDetail": "Consumer disabled."
},
"response": {}
}
I've searched my emails, but I didn't recieve any warnings or notifications on why this might be happening. Anyone had any experience with this?
One thing that may be of importance: Since I'm in development and there is no site for the project yet I can not provide a privacy policy url in the app settings. Because there is none, yet.
Edit: this is my client ID: 1VXNUT53J2OMMTMKA4E3UBKYLQQCI1GC3CRCCBPSQK1BWQFG
try resetting your API secret at (https://foursquare.com/developers/app/CLIENT_ID/reset)
That error could happen if there's suspicious behavior on an API key - but you would've gotten an email first.
Update: I see this key flagged as disabled. I re-enabled so should be working now. I'll run through the logs and try to figure out how/why this happened.

Google Page Speed Insights API: Internet Error

I am getting an error from Google PageSpeed Insights API. Its just returns Internal Error with Code 500.
Here is the detailed response:
"error": {
"errors": [
{
"domain": "global",
"reason": "internalError",
"message": "An error occurred while fetching or analyzing the page."
}
],
"code": 500,
"message": "An error occurred while fetching or analyzing the page."
}
}
I also Tried with Google API key from within Google Cloud Console (Enabled
PageInsights APi for my account). No Luck still the same message.
Here is a result screenshot of the same page tested on tools.pingdom.com
It would be helpful if Google Provided detailed error messages which can help us identify where the issue is. Any help or pointers on this would be great.
The issue was with an SVG image. Once it was removed Page Speed starting working. Still not sure what was wrong with the image.
You have too many resources loading on page load. The Render limit is 200.
You can also try to test your site with think with Google

authenticate to Google Computer Engine instance using CLI

I've set up a Google Compute Engine Instance and I want to be able to turn it on and off using a script on my home computer. I see that there's an API that lets me do that by sending a POST request like this:
curl --data '' https://www.googleapis.com/compute/v1/projects/my-project/zones/asia-east1-a/instances/my-instance/stop
but the response I get from that is this:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
So I'm trying to see how I can allow my script authorisation to use the API on the compute engine without having user interaction. How do I do this?
It looks like Google requires OAuth 2.0 authentication, but it seems really complex.
The closest thing I can find in Google's docs is this page but I can't work out how to make it a bunch of curl statements.
This SO thread gets closer, but glancing over the scripts there - it looks like they need user interaction.
I think you need Application Default Credentials. Have you seen this page?
https://developers.google.com/identity/protocols/application-default-credentials

Google Purchase Status API HTTPS request

I am currently researching a way to use the Google Purchase Status API with just HTTP request calls, and I have hit a brick wall. I have an app setup with Google Play, and ownership of the Google Console account.
Basically, I just would like to check the status of a user's purchase on my server. The only information I should be using is the purchase token, product ID, and product package.
I have followed all the documentation on doing this at developer.android.com/google/play/billing/gp-purchase-status-api.html
The HTTPS request call I am attempting to make is this (product names and real strings substituted):
googleapis.com/androidpublisher/v1.1/applications/(com.product.myproduct)/inapp/(com.product.myproduct.product1)/purchases/(myproductpurchasestring)?access_token=(myaccesstokenstring)
and my response is always this:
{
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "developerDoesNotOwnApplication",
"message": "This developer account does not own the application."
}
],
"code": 401,
"message": "This developer account does not own the application."
}
}
When polling my access token through this http request call:
googleapis.com/oauth2/v1/tokeninfo?access_token=(myaccesstokenstring)
this is my response:
{
"issued_to": "12345.apps.googleusercontent.com",
"audience": "12345.apps.googleusercontent.com",
"scope": "https://www.googleapis.com/auth/androidpublisher",
"expires_in": 3319,
"access_type": "offline"
}
So according to the documentation at https://developers.google.com/accounts/docs/OAuth2#webserver, I need to:
Authorise myself and retrieve a refreshable access token that is generated from 'Client ID for web applications' in the API access section of the Google API Console. I have done this.
Utilise this access token for google API calls in either of 2 ways: appending the string to the HTTP header 'Authorization', or as part of the HTTPS request itself with the property access_token=(mytokenstring). This part does not work for me, I always get an unauthorised message.
My question I guess would be: is it possible to use a simple HTTPS request call (without external library support) to retrieve the status of a purchased item without user interaction on backend servers?
I would really appreciate any help, most of the other threads are about how to go about getting a refresh token, but I have covered that already.
ok, I figured out my own problem with the help of a colleague. Basically, my access token was being generated under an account which wasn't linked to the project in any way. It would be safest to use the owner of the project's google account when generating the access token.
Phew!