verify_oauth2_token uses object as function

Viewed 996

I was doing google auth with use of backend from there: https://developers.google.com/identity/sign-in/android/backend-auth

It seems a bit outdated and the most strange thing is that there is a line:

idinfo = id_token.verify_oauth2_token(token, requests.Request(), CLIENT_ID)

and in implementation you can see that in nested function calls, same request object lands there:

def _fetch_certs(request, certs_url):
"""Fetches certificates.

Google-style cerificate endpoints return JSON in the format of
``{'key id': 'x509 certificate'}``.

Args:
    request (google.auth.transport.Request): The object used to make
        HTTP requests.
    certs_url (str): The certificate endpoint URL.

Returns:
    Mapping[str, str]: A mapping of public key ID to x.509 certificate
        data.
"""
response = request(certs_url, method='GET')

request is an object, even documentation claims so and it uses it as function. The error I get is:

TypeError: 'Request' object is not callable

What should be changed there?

1 Answers
Related