Communicating with Google Auth API using an issuer and secret - Python

59 Views Asked by At

I need to connect to a server API. The server's API requires that I provide an owner in the parameters (which I have and it is the same as the issuer) and a key that is given by Google Authenticator. I can do that manually by downloading the Google Authenticator extension and adding an account using the manual entry option with the issuer and secret. I want to be able to do that programatically. It should be something like this:

key_object = connect_to_google_authenticator(issuer="some issuer", secret="some secret")

The key object should have the key (a six-digit combination) and preferably a flag indicating whether it's expired or not and a refresh method to get the new key instead of having to reauthenticate.

I've seen google.auth, but it doesn't seem to provide me with the option to log in using an issuer and secret, but instead requires a json object about which I've been unable to find much information. Is there a way to do this or at least a documented Google Authenticator API so I can do that myself?

0

There are 0 best solutions below