I'm back once again with a new question, I'm developing an application that pulls several Google APIs. My problem is the login, which I would like to be fixed.
I'll explain a little more in detail, I currently know two different ways to authorize an application to use Google services for a given user:
- Authorization via Web through a code, the user logs in to Google, then authorizes the scopes, which gives him a code that he has to insert in my app.
- Authorization via Web, the user needs to log in and authorize my application, with this step I skip the one that has to enter a code.
Once these two cases have been detailed, which are great for when the user is not fixed, I would like to know if there is a way to login through a fixed account without having to manually log in to said account. bill.
The answer could be in Python (the language I am developing this app with) or java.
Thanks in advance
Cheers
EDIT: I am using the Google Apps
Use the service account option. Details are listed at https://developers.google.com/identity/protocols/OAuth2ServiceAccount
original excerpt
Translation
I don't know if I have understood your question correctly, but if you want to be able to log in to a Google account to be able to access services that require it, such as viewing mail, using Python code, a simple method is to parse the login page to obtain the
imput
user data (Email
) and password ('Passwd'
), add both data and then send it to authenticate us. Usingrequests
that allows the persistence of session cookies,BeautifulSoup
to parse the html andPython3.x
it can look something like this:To create a session you just have to instantiate the class and pass it our username (email) and password. Once this is done, we can use our instance to access pages that require being logged in, for example we can access our email inbox as shown below: