How to configure Gmail API on a AWS Ubuntu VPS? I am able to make it work properly on my Linux Machine, but after I run the code on my VPS, it asks me to authenticate by visiting the URL. I copied the URL and tried authenticating myself. While authenticating myself in browser, I am redirected to localhost:<random-port>?state=... and cannot authenticate myself as it cannot connect to localhost. How can I configure this properly on my Ubuntu VPS?
i have used the default code provided by google developers: https://developers.google.com/gmail/api/quickstart/python
I have encountered the same problem.
When you will try to authenticate using your browser, it will try to redirect you to some localhost URL. Just copy that localhost URL, log in to your VPS, open the terminal, type python3 (or python), and finally type these commands:
import requests
url = "http://localhost:xxxxx-url-you-got-in-your-browswer"
resp = requests.get(url)
exit()
After these commands, it should generate a Gmail API token.
Related
At this CORS issue
I asked the client to edit the backend side.
Due to my lack of knowledge
I do not understand the conversation of the following.
My client : Can you implement backend to overcome this cors issue.
Me : Who made Backend and what language? My client : I meant,
backend for your frontend. Not actual backend , frontend backend that
will act as a proxy. You can implement this backend proxy in python
It means that Python can act as a bridge between Backend and React?
(Not sure if it's possible...)
To solve the CORS issue on the front side
Write the code below
axios.defaults.headers.get['Access-Control-Allow-Origin'] = '*';
Also, just in case, I used a browser plug-in to allow access.
Still getting the same error. .
I did try it Postman.
Launch a browser that can ignore CORS with the following command in the terminal
By accessing the URL from there
Once I was able to work around the CORS issue.
open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security
I'm working Django Project.
How to create a Public IP permanently for Localhost(127.0.0.1:8000) IP in Django Project.
After Creating Public URL, how to allow access for Other users without Source Code
when I run python manage.py runserver x.x.x.x:8088 in command prompt it is generating a URL with specified IP address. But when I share/open this URL with others it is not working
Can any one help me to configure this issue.
Thanks in advance.
You can use ngrok for this purpose
After running the server, you can open the HTTP(s) tunnel with ngrok
./ngrok 8000
and you will get the public URL of your service.
On free version the URL will be vary each time you run ngrok
I created an application in Flask Python with a frontend in HTML and Twilio SDK JavaScript version 2.3.0.
A video call is working on local host, but if I try the same app over HTTPS with a valid certificate, it is fetching the token correctly for the video call, but it can't establish a connection to Twilio.
I have tried forcing the browser permissions for the camera and audio to allow and it did not make a difference.
So to load the Twilio script, you need to enable https in both the website and the script. Otherwise, it will mix up HTTP and HTTPS and fail. So there are two simple things to do:
put your website over HTTPS
load the https://media.twiliocdn.com/sdk/js/video/releases/2.3.0/twilio-video.min.js file over HTTPS in file index.html.
This will solve your problem.
Today I'm dealing with a Python3 script that has to do a http post request and send a mail.
The Python script is launched on a Windows PC that is in a corporate network protected by Forefront.
The user is logged with his secret credentials and can access to the internet through a proxy.
Like the other non-Microsoft applications (i.e. Chrome), I want my script to connect to the internet without prompt the user for his username and password.
How can I do this?
On Microsoft OSes, the authentication used is Kerberos, so you won't be able to use directly your ID + password.
I'm on Linux, so I can't test it directly but I think that you can create a proxy with fiddler which can negociate the authentication for you, and you can use this proxy with python.
Fiddler's Composer will automatically respond to authentication challenges (including the Negotiate protocol which wraps Kerberos) if you tick the Authentication box on the Options subtab, in the menus.
I have a python script that needs to make an http request (using the requests library) to an IIS server with ntlm authentication.
The script will run on a RedHat box, where the user's login credentials are authenticated with ActiveDirectory.
If you have a valid username/password for the AD domain, and therefore the web server, the use of requests-ntlm to authenticate to the server is obvious enough.
But what I'd like to do is to be able to authenticate to the web server using the user's session on the RedHat box, so the user doesn't have to type in their username & password again. Is this possible/how do you do this?