I am trying to get to work a sample described here (with Calendar API):
http://googleappsdeveloper.blogspot.hu/2011/12/using-new-js-library-to-unlock-power-of.html
The code itself runs properly, but I always get an error message (pasted from JSON):
"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
Of course I have enabled the Calendar API for my project, I have set the api and the client keys too.
I would really appreciate some help. Thank you! :)
"Access not configured" error is thrown when the project is not configured to access THIS API.
Can you check whether Calendar API is enabled to this project(which you are getting error)?
Also, this error can happen due to the below reasons:
The project which is throwing error has been blocked due to abuse.
The project has been marked for deletion.
Here is the link for documentation on the standard error messages.
The problem seems solved. As it seems, the sample source code was wrong at some points. You should better use google's own sample codes to try out APIs.
I got this error on Android using GoogleAuthUtil to get the token. Eventually I realised that I was compiling on a different machine with a different SHA1 certificate.
To fix it I added another Android ClientID in the google developers console and also needed to call GoogleAuthUtil.invalidateToken
Related
My wife has over 12k Pinterest pins and there are many that resolve to 404 errors. I thought it would be simple to just create a chrome extension she could run that would get the pins, then I would test the URLs for 404 errors and then perform a delete.
Creating the plugin wasn't difficult but of all things, I am getting hung up on being able to determine whether the remote URL is a 404 due to CORS issues. Using fetch with a mode of no-cors does not error but it doesn't return me anything that I can use to determine whether the link is valid or not. I understand the purpose of CORS, but I'm just surprised that there isn't a way to tell from javascript whether or not a domain is valid.
I've seen some approaches where it was stated to use a proxy which I guess you append the headers with, however I thought I would see if there was any creative means of telling whether an endpoint is even existent or not. I'm really only interested in capturing the broken links so I can then go about deleting the pins programmatically. I was going to go about testing whether I could use an iframe to assign src to the url and see if I'm able to extract any more info that way, but figured I would post here to see if there are any other creative approaches. I also tried performing a fetch for favicon.ico, thinking it would get around CORS due to it being an image and not the full page, but this didn't work as well as I was hoping.
If you have any ideas, please let me know. Thanks!
For several years we have successfully been uploading videos via the YouTube API using some custom JavaScript code. The code was based on some samples provided by Google (cors_upload.js). It's not something we use a lot, just every couple of weeks.
Things were working fine a couple weeks ago, but it has come to my attention that things recently stopped working. We login fine, we obtain the channel info fine. But when we start the upload (which happens via XHR POST), we are getting a CORS error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.googleapis.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
But we haven't changed anything in our code or on our server and it appears as if we are doing all the things necessary as documented by Google to have their service respond with the required CORS headers.
According to the dev console, the XHR request actually generates 2 network requests. First I see an "OPTIONS":
Request URL:https://www.googleapis.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable
Request Method:OPTIONS
Remote Address:172.217.9.42:443
This actually DOES return the "access-control-allow-origin" header that I expect. However, this is immediately followed by the "POST" request:
Request URL:https://www.googleapis.com/upload/youtube/v3/videos?part=snippet%2Cstatus&uploadType=resumable
Request Method:POST
Remote Address:172.217.9.42:443
And according to the dev console, it does NOT have the "access-control-allow-origin" header set. So, I understand why my browser is rejecting things. It just seems like Google broke something.
I did successfully deploy a NodeJS "CORS Anywhere" server on a server we manage. So, I can use that to work around the issue. But that really isn't the correct solution to the problem. Since uploading videos programmatically isn't something we do a ton, this work around will probably be sufficient for us. I would love to understand what went wrong or how to fix. So, if someone is successfully uploading videos with the YouTube API and JavaScript, I would love to hear about it. Hopefully this will help educate others if/when they run into the issue.
The same problem just started to happen with my services.
It seems to be a bug on googleapis or maybe youtube.v3.apis had a policy change and started to block some clients.
Google has fixed the problem and our long-standing code is back to working again without any changes.
Here is the tracked issue:
https://issuetracker.google.com/issues/158718687
Same here. I have no Solution, just a workaround and I hope they fix it soon. You can disable the CORS safetycheck in chrome. Run chrome.exe with --disable-web-security and set the user-data Directory temporary to another location, with the following parameter and the folder you want --user-data-dir=c:/anyfolderName/`
For security reasons you should disable-web-security only if you have to and switch back if youre done.
I dont know why this get a downvote, because it helped me to get around. Now google fixed the issue, no need to use this workaround longer. But maybe it helps when another CORS issue arise...
I have a site that is running in Node and using express for the server. I also have an API on a different server I need to hit. Everything works fine except in IE9. The issue is when ever i try to hit my API once i have the page loaded it breaks.
For example on the home page i have a search form where each step makes an API fetch and once I try to make my first fetch i get this error
"Unhanded promise rejectionError: Access Denied"
It seems like it has to do with a CORS issue since IE9 didnt have CORS and the era of the error message. Also when I make the fetched server side I have no issue, its just when the client tries to perform them.
Has anyone had an issue like this and if so how did you fix it?
Currently I am trying this but it hasnt worked yet:
First I changed my api host address to the current sites address with /api at the end.
apiHost: process.env.API_HOST || 'http://127.0.0.1:3000/api'
Then in my express server is run this:
app.use(modRewrite([`^/api/(.*)$ http://api.mysite.dev:8080/$1 [P]`]));
I was hoping to avoid making a fetch cross address with this but no luck as of yet.
Any help would be much appreciated
thanks!
To solve this problem I changed my host file for my machine to use mysite.dev for the 127.0.0.1 IP. Then went to mysite.dev rather than 127.0.0.1 when testing my site. Then did what I did above to get it to work
I am trying to implement the quickstart application that has been posted here . I am doing everything as it has been instructed. On running the application i get a error of as shown in the screenshot
[01:19:19.661] GET https://accounts.google.com/o/oauth2/auth?client_id=590193668021-m0poda5f50214v9vjvlkqvsg08t0qses.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&immediate=true&proxy=oauth2relay777233220&redirect_uri=postmessage&origin=http%3A%2F%2Flocalhost%3A8000&response_type=token&state=1371767407%7C0.2276743408&authuser=0 [HTTP/1.1 400 Bad Request 384ms]
I am unable to figure out what the problem is.
I am running the internet on a proxy setup in our college. ( Does it have any role in making it not work ?).
Please help. Thanks in advance.
UPDATE
Please run your application directly on a registered domain to test your code. It won't work on localhost straighaway.
For making it work on a localhost, one has to make a subdomain as instructed in the comments.
Thanks.
I have recently started working on javascript and json. I am trying to implement localization where I can support multiple languages using json files. The javascript file i18n.js library provides translation helper functions and is available on net. The error which I am facing is
Uncaught Exception:NETWORK_ERROR: XMLHttpRequest Exception 101.
This error is thrown when we try to send the request.open() method is called with url passed is local(lang/de.json). Even though I am not sending my request to any web url its throwing this error.
Any help will be great for me. If more details are needed I can post it further.
Thanks
is this a cross-domain request (google "same origin policy")? If it's requesting file from remote domain, you need to use JSONP technique. Otherwise I'm not sure without further information (rest of the code you have in context, server side code maybe...) can you debug it with a javascript console (firebug)?
Well, the error you are describing is indicative of a cross domain request that the DOM can't access. Firebug would likely give you the same error, but you can look at the XHR requests in the console as it's being sent and see what URL it's going to. It would also indicate any issues you are having in your javascript if they are syntax errors or DOM issues.