Nodemailer/Gmail – What exactly is a refresh token and how do I get one?

Notes by this answer original’s author: So, I finally managed to figure it out. I’m surprised I couldn’t find more ressources about that so for those who need to use Gmail with Nodemailer I found the answer here: http://masashi-k.blogspot.fr/2013/06/sending-mail-with-gmail-using-xoauth2.html Try creating a new User if you already had one and things ain’t working fine. It … Read more

Python requests library how to pass Authorization header with single token

In python: (‘<MY_TOKEN>’) is equivalent to ‘<MY_TOKEN>’ And requests interprets (‘TOK’, ‘<MY_TOKEN>’) As you wanting requests to use Basic Authentication and craft an authorization header like so: ‘VE9LOjxNWV9UT0tFTj4K’ Which is the base64 representation of ‘TOK:<MY_TOKEN>’ To pass your own header you pass in a dictionary like so: r = requests.get(‘<MY_URI>’, headers={‘Authorization’: ‘TOK:<MY_TOKEN>’})