google drive javascript quickstart application giving 400 Bad Request - javascript

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.

Related

Spring Boot application: net::ERR_CONNECTION_REFUSED

For a school project we are creating a Spring Boot application based on Restful. It works flawlessly locally, but once deployed to AWS I receive "net::ERR_CONNECTION_REFUSED" on all GET and POST requests I send to my RestController.
If I just host my database on AWS it works fine locally, but as soon as I upload my project to an AWS instance it goes back to "net::ERR_CONNECTION_REFUSED". I get no exception in Java.
Does anyone have any idea about this? If so, I'd be more than grateful for the help.
I can of course show any code you need to see to clarify anything, I'm just unsure which code would be relevant.
Thanks a lot,
I hope you are all well.
I figured out the issue. I was running both front end and backend in the same project which resulted in API calls from the very same project to ip:8080 was void. I hosted the backend on ip:9090 and the frontend on ip:8080 in order for it to work.

ERR_CERT_COMMON_NAME_INVALID from jQuery Using Reverse Proxy

I am having an issue with 'ERR_CERT_COMMON_NAME_INVALID' when making a request from a website.
First of all, am really a bit of a novice when it comes to setting up and using certs... so this is probably something stupid that I have ether done or not done!
I have a ssl certificate www.my-dummy-url.abc and api.my-dummy-url.abc (obviously my-dummy-url is for example only). Where api.my-dummy-url.abc is the certificate Subject Alternative Name and www.my-dummy-url.abc is the certificate Subject.
The Apache Web sever, is hosted at www.my-dummy-url.abc, whilst a reverse proxy points 'api.my-dummy-url.abc to a Raspberry Pi running a little node.js API endpoint (/weather).
I have set node.js up to use express: https.createServer(ssl_options, ..., where ssl_options is my cert.pem and key.pem. CORS is enabled (app.use(cors());) and 'Access-Control-Allow-Origin', '*' is present in the response.
The Website (apart from the API call) renders fine at https://www.my-dummy-url.abc (Chrome).
The API, (https://api.my-dummy-url.abc/weather) if requested within the address bar of a Chrome browser or through Postman receives the correct JSON response.
However, from my website as a jQuery $.get function I get the following error:
GET https://api.my-dummy-url.abc/weather net::ERR_CERT_COMMON_NAME_INVALID
Any ideas, helpers, pointer or solutions will be gratefully received...
As an addition, if I use Edge rather then Chrome, it works...!
Kind Regards,
Harold Clements
This issue was that Chrome was caching the certificate somehow. After shutting down and coming back to it the next day, it was working fine.

Can't make a fetch in IE9 once page is loaded

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

Google APIs Client Library for JS 'Access Not Configured' error

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

Angularjs: Node server that supports html5mode?

I'm locally developing an Angularjs app. I'm using the same node web server as in the Angularjs tutorial. The link to the code for the web-server on Github.
The problem is that I can't seem to get html5mode to work on the node server. What I understand so far is that i have to add a base href to my app and rewrite the server code. I tried rewriting the node web server code, but I failed and it didn't work. Could someone please help me in what i should exactly change? Or does someone maybe already has a version of the server rewritten?
The link to my app looks like this: http://localhost:8000/app/index.html
Also refreshing the page on a html5 link doesn't work. Like this: http://localhost:8000/schedule.
Thanks
You have to rewrite incoming requests that aren't to your REST endpoints respond with the same response as the request to /app/index.html.

Categories