Google Web Client with Oauth2 suddenly stops working - google-api

I'm creating a Social Platform using Google Login. The App works fine until next day that stop recieving the callback URI correctly when I try again to login with google.
Everytime I get the error I create a new Web Client and works just fine until the next day that I get a 401 Error, then change the URI callback to localhost instead of 127.0.0.1. It starts working just fine until the next day that I get the 400 Error.
Any idea what is causing this change that the system stops working after 1 day? It start asking for 127.0.0.1 but even if I put that it gets the same error.

The redirect URI in Google deveoper console needs to exactly match the one your code is sending from.
you are sending from http://127.0.0.1:8000/accounts/google/login/callback/ and its not in your list of approved redirect uris.
Remember the full path needs to match with the port.

Related

Go gmail api quickstart results in localhost refused to connect ERR_CONNECTION_REFUSED

I'm following the steps in go quickstart gmail api.
On the function getTokenFromWeb, pasting either the long url
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=abcdefg.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly&state=state-token
or
http://localhost:8000
results in
This site can't be reached. localhost refused to connect. ERR_CONNECTION_REFUSED
Following the same quickstart but for python works flawlessly.
If I get the token via python and use it in Go quickstart, it also works. So the issue is just on the token from web retrieval.
The issue you are having is related to the removal of oob. When that sample was originally created oob still worked. So it would display a nice web page for you where you could copy the authorization code.
That no longer works so we are forced to use http://127.0.0.1 or localhost. As your machine apparently does not have a web server running its displaying to you a 404 error.
However if you look in the URL bar you will find the authorization code you need in order to authorize your application.
The solution is to simply copy the code from the url bar. If you want to fix the 404 your going to have to figure out how to start a web server in order to host the http://127.0.0.1 from.
The python sample does this by running a local server
creds = flow.run_local_server(port=0)
Php can do it using something like this
php -S localhost:8000 -t examples/
Im not sure how that can be done with Go though.

setInterval() ajax call is working on local server but giving error in online server

I have a website in which there is chatroom where I use to send AJAX request to check if a person received a new message or not. If a new message is received, it gets appended to the DOM without refreshing the page (like Facebook).
I am using:-
setInterval(check_if_new_message, 1000);
i.e. one AJAX request to check message every one second.
This was working fine as it was supposed to when I was trying to run on the local server. But then I bought Starter Shared Linux Hosting on GoDaddy and then my ajax requests are not working properly. First 100-150 requests are working fine but after that, it stars giving an error like net::ERR_CONNECTION_CLOSED in the console of the browser.
setInterval(check_if_new_message, 1000);
You can see that you are using:
setInterval(check_if_new_message, 1000);
That means you are calling check_if_new_message after every 1 second. This works well in the localhost because it is on your computer. But when you try this on a live server, you will get:
net::ERR_CONNECTION_CLOSED
This is because your server can not handle so many requests. Your server may have less RAM.
This is not a good practice for a real-time chat application.
If you want to make a realtime chat application use WebSocket for that.
Useful resources for WebSocket:
What is WebSocket?
WS library

Trying to get direct line to point ngrok failing

I have run my bot locally (success)
I have set ngrok (success)
I have tested the remote url (success)
I have added Direct Line webchat to my local running site (success)
I have set up Direct Line and used this secret in my webchat (success)
However, I still get the old bot response (hosted on Azure)
So I have gone to the bot framework website --> my bot --> settings --> Messaging endpoint and set the URL as my ngrok address
It seems to be saved, but I get a strange popup saying
CorrelationID : SHUjnuhs=
Or some other random shortcode.
Seems to be an error from API/botmanager and response to an error 500
Just wondered if there is something else I am missing here in order to get direct line speaking to my locally running bot
Usually, that error means that the messaging endpoint has a space at the beginning and so it's not being saved (that's why you are seeing the old message). Reload the page, and before saving make sure there is no space at the begiining of the url.

Tasker HTTP Get returns file not found

I'm attempting to use tasker to go back and forth with the ecoBee API. In doing so, I've been unable to get past the first step due to an issue I'm running into with tasker.
Here's my setup:
Server:Port - https://api.ecobee.com:443 (I've also tried without the port, and without the https://
Path - /1/authorize
Mime Type - application/json
Trust Any Certificate
When running this i get a Tasker toast message that states "Input/Output error for https://api.ecobee.com:443/1/authorize : java.io.FileNotFoundException: https://api.ecobee.com:443/1/authorize"
Going to that URL works from the phone browser and a computer browser. Am I missing something obvious?
Try using https://api.ecobee.com/authorize URL instead. Seems like your URL is wrong. You can also see valid URL's for Authorize call here: Authorization Endpoints

Google checkout callback can't seem to reach https server

I am trying to implement Google Check out (GCO) on a new server, the process seemed to work fine on the old server.
The error from GCO integration console is the timeout error you might expect if there is load on the server and/or the response takes longer than 3 seconds to respond.
To perform a test (not integrating with my database), I have set some code to send an email to me instead. If I hit the https url manually, I get the email and I can see an output to the screen. If I then leave it as that, Google still returns the Timeout error and I don't get an email. So I have doubts as to whether google is even able to hit the https url.
I did temporarily attempt to use the unsecure url for testing and indeed I received the email, however this solution isn't the route we've developed for, so the problem is something to do with the secure url specifically.
I have looked into the certificate which is a UTN-USERFirst-Hardware which is listed as accepted on http://checkout.google.com/support/sell/bin/answer.py?answer=57856 . I have also tried to temporarily disable the firewall with no joy. Does anyone have any sugestions?
Good to hear you figured out the problem.
I'm adding the links below to add a litle more context for future readers about how Google Checkout uses HTTP Basic Authentication:
http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API.html#urls_for_posting
http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API.html#https_auth_scheme
http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API_Notification_API.html#Receiving_and_Processing_Notifications

Resources