Python oauth2client.GOOGLE_TOKEN_URI Examples
The following are 30
code examples of oauth2client.GOOGLE_TOKEN_URI().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
oauth2client
, or try the search function
.
Example #1
Source File: client.py From earthengine with MIT License | 6 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #2
Source File: client.py From twitter-for-bigquery with Apache License 2.0 | 6 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #3
Source File: client.py From googleapps-message-recall with Apache License 2.0 | 6 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #4
Source File: service_account.py From aqua-monitor with GNU Lesser General Public License v3.0 | 6 votes |
def create_scoped(self, scopes, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI): # Returns an OAuth2 credentials with the given scope result = ServiceAccountCredentials(self._service_account_email, self._signer, scopes=scopes, private_key_id=self._private_key_id, client_id=self.client_id, user_agent=self._user_agent, token_uri=token_uri, revoke_uri=revoke_uri, **self._kwargs) if self._private_key_pkcs8_pem is not None: result._private_key_pkcs8_pem = self._private_key_pkcs8_pem if self._private_key_pkcs12 is not None: result._private_key_pkcs12 = self._private_key_pkcs12 if self._private_key_password is not None: result._private_key_password = self._private_key_password return result
Example #5
Source File: service_account.py From aqua-monitor with GNU Lesser General Public License v3.0 | 6 votes |
def __init__(self, service_account_email, signer, scopes=None, private_key_id=None, client_id=None, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, additional_claims=None): if additional_claims is None: additional_claims = {} super(_JWTAccessCredentials, self).__init__( service_account_email, signer, private_key_id=private_key_id, client_id=client_id, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri, **additional_claims)
Example #6
Source File: google.py From pghoard with Apache License 2.0 | 6 votes |
def get_credentials(credential_file=None, credentials=None): if credential_file: return GoogleCredentials.from_stream(credential_file) if credentials and credentials["type"] == "service_account": return ServiceAccountCredentials_from_dict(credentials) if credentials and credentials["type"] == "authorized_user": return GoogleCredentials( access_token=None, client_id=credentials["client_id"], client_secret=credentials["client_secret"], refresh_token=credentials["refresh_token"], token_expiry=None, token_uri=GOOGLE_TOKEN_URI, user_agent="pghoard") return GoogleCredentials.get_application_default()
Example #7
Source File: service_account.py From aqua-monitor with GNU Lesser General Public License v3.0 | 6 votes |
def __init__(self, service_account_email, signer, scopes='', private_key_id=None, client_id=None, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **kwargs): super(ServiceAccountCredentials, self).__init__( None, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri) self._service_account_email = service_account_email self._signer = signer self._scopes = util.scopes_to_string(scopes) self._private_key_id = private_key_id self.client_id = client_id self._user_agent = user_agent self._kwargs = kwargs
Example #8
Source File: service_account.py From jarvis with GNU General Public License v2.0 | 6 votes |
def __init__(self, service_account_email, signer, scopes='', private_key_id=None, client_id=None, user_agent=None, token_uri=oauth2client.GOOGLE_TOKEN_URI, revoke_uri=oauth2client.GOOGLE_REVOKE_URI, **kwargs): super(ServiceAccountCredentials, self).__init__( None, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri) self._service_account_email = service_account_email self._signer = signer self._scopes = _helpers.scopes_to_string(scopes) self._private_key_id = private_key_id self.client_id = client_id self._user_agent = user_agent self._kwargs = kwargs
Example #9
Source File: credentials.py From google-analytics with ISC License | 6 votes |
def oauth(self): if self.incomplete: return None else: if self.type == 2: return oauth2client.client.SignedJwtAssertionCredentials( service_account_name=self.client_email, private_key=self.private_key.encode('utf-8'), scope='https://www.googleapis.com/auth/analytics.readonly', ) else: return oauth2client.client.OAuth2Credentials( access_token=self.access_token, client_id=self.client_id, client_secret=self.client_secret, refresh_token=self.refresh_token, token_expiry=None, token_uri=oauth2client.GOOGLE_TOKEN_URI, user_agent=None, revoke_uri=oauth2client.GOOGLE_REVOKE_URI, id_token=None, token_response=None )
Example #10
Source File: service_account.py From alfred-gmail with MIT License | 6 votes |
def __init__(self, service_account_email, signer, scopes='', private_key_id=None, client_id=None, user_agent=None, token_uri=oauth2client.GOOGLE_TOKEN_URI, revoke_uri=oauth2client.GOOGLE_REVOKE_URI, **kwargs): super(ServiceAccountCredentials, self).__init__( None, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri) self._service_account_email = service_account_email self._signer = signer self._scopes = util.scopes_to_string(scopes) self._private_key_id = private_key_id self.client_id = client_id self._user_agent = user_agent self._kwargs = kwargs
Example #11
Source File: service_account.py From jarvis with GNU General Public License v2.0 | 6 votes |
def __init__(self, service_account_email, signer, scopes=None, private_key_id=None, client_id=None, user_agent=None, token_uri=oauth2client.GOOGLE_TOKEN_URI, revoke_uri=oauth2client.GOOGLE_REVOKE_URI, additional_claims=None): if additional_claims is None: additional_claims = {} super(_JWTAccessCredentials, self).__init__( service_account_email, signer, private_key_id=private_key_id, client_id=client_id, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri, **additional_claims)
Example #12
Source File: service_account.py From jarvis with GNU General Public License v2.0 | 6 votes |
def create_scoped(self, scopes, token_uri=oauth2client.GOOGLE_TOKEN_URI, revoke_uri=oauth2client.GOOGLE_REVOKE_URI): # Returns an OAuth2 credentials with the given scope result = ServiceAccountCredentials(self._service_account_email, self._signer, scopes=scopes, private_key_id=self._private_key_id, client_id=self.client_id, user_agent=self._user_agent, token_uri=token_uri, revoke_uri=revoke_uri, **self._kwargs) if self._private_key_pkcs8_pem is not None: result._private_key_pkcs8_pem = self._private_key_pkcs8_pem if self._private_key_pkcs12 is not None: result._private_key_pkcs12 = self._private_key_pkcs12 if self._private_key_password is not None: result._private_key_password = self._private_key_password return result
Example #13
Source File: client.py From sndlatr with Apache License 2.0 | 6 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #14
Source File: client.py From data with GNU General Public License v3.0 | 6 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #15
Source File: service_account.py From data with GNU General Public License v3.0 | 6 votes |
def __init__(self, service_account_id, service_account_email, private_key_id, private_key_pkcs8_text, scopes, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **kwargs): super(_ServiceAccountCredentials, self).__init__( None, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri) self._service_account_id = service_account_id self._service_account_email = service_account_email self._private_key_id = private_key_id self._private_key = _get_private_key(private_key_pkcs8_text) self._private_key_pkcs8_text = private_key_pkcs8_text self._scopes = util.scopes_to_string(scopes) self._user_agent = user_agent self._token_uri = token_uri self._revoke_uri = revoke_uri self._kwargs = kwargs
Example #16
Source File: service_account.py From alfred-gmail with MIT License | 6 votes |
def __init__(self, service_account_email, signer, scopes=None, private_key_id=None, client_id=None, user_agent=None, token_uri=oauth2client.GOOGLE_TOKEN_URI, revoke_uri=oauth2client.GOOGLE_REVOKE_URI, additional_claims=None): if additional_claims is None: additional_claims = {} super(_JWTAccessCredentials, self).__init__( service_account_email, signer, private_key_id=private_key_id, client_id=client_id, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri, **additional_claims)
Example #17
Source File: client.py From data with GNU General Public License v3.0 | 6 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #18
Source File: service_account.py From alfred-gmail with MIT License | 6 votes |
def create_scoped(self, scopes, token_uri=oauth2client.GOOGLE_TOKEN_URI, revoke_uri=oauth2client.GOOGLE_REVOKE_URI): # Returns an OAuth2 credentials with the given scope result = ServiceAccountCredentials(self._service_account_email, self._signer, scopes=scopes, private_key_id=self._private_key_id, client_id=self.client_id, user_agent=self._user_agent, token_uri=token_uri, revoke_uri=revoke_uri, **self._kwargs) if self._private_key_pkcs8_pem is not None: result._private_key_pkcs8_pem = self._private_key_pkcs8_pem if self._private_key_pkcs12 is not None: result._private_key_pkcs12 = self._private_key_pkcs12 if self._private_key_password is not None: result._private_key_password = self._private_key_password return result
Example #19
Source File: client.py From splunk-ref-pas-code with Apache License 2.0 | 6 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #20
Source File: client.py From data with GNU General Public License v3.0 | 5 votes |
def __init__(self, service_account_name, private_key, scope, private_key_password='notasecret', user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **kwargs): """Constructor for SignedJwtAssertionCredentials. Args: service_account_name: string, id for account, usually an email address. private_key: string, private key in PKCS12 or PEM format. scope: string or iterable of strings, scope(s) of the credentials being requested. private_key_password: string, password for private_key, unused if private_key is in PEM format. user_agent: string, HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. kwargs: kwargs, Additional parameters to add to the JWT token, for example sub=joe@xample.org.""" super(SignedJwtAssertionCredentials, self).__init__( None, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri, ) self.scope = util.scopes_to_string(scope) # Keep base64 encoded so it can be stored in JSON. self.private_key = base64.b64encode(private_key) self.private_key_password = private_key_password self.service_account_name = service_account_name self.kwargs = kwargs
Example #21
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def _get_application_default_credential_from_file(filename): """Build the Application Default Credentials from file.""" # read the credentials from the file with open(filename) as file_obj: client_credentials = json.load(file_obj) credentials_type = client_credentials.get('type') if credentials_type == AUTHORIZED_USER: required_fields = set(['client_id', 'client_secret', 'refresh_token']) elif credentials_type == SERVICE_ACCOUNT: required_fields = set(['client_id', 'client_email', 'private_key_id', 'private_key']) else: raise ApplicationDefaultCredentialsError( "'type' field should be defined (and have one of the '" + AUTHORIZED_USER + "' or '" + SERVICE_ACCOUNT + "' values)") missing_fields = required_fields.difference(client_credentials.keys()) if missing_fields: _raise_exception_for_missing_fields(missing_fields) if client_credentials['type'] == AUTHORIZED_USER: return GoogleCredentials( access_token=None, client_id=client_credentials['client_id'], client_secret=client_credentials['client_secret'], refresh_token=client_credentials['refresh_token'], token_expiry=None, token_uri=GOOGLE_TOKEN_URI, user_agent='Python client library') else: # client_credentials['type'] == SERVICE_ACCOUNT from oauth2client.service_account import ServiceAccountCredentials return ServiceAccountCredentials.from_json_keyfile_dict( client_credentials)
Example #22
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #23
Source File: client.py From data with GNU General Public License v3.0 | 5 votes |
def __init__(self, service_account_name, private_key, scope, private_key_password='notasecret', user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **kwargs): """Constructor for SignedJwtAssertionCredentials. Args: service_account_name: string, id for account, usually an email address. private_key: string, private key in PKCS12 or PEM format. scope: string or iterable of strings, scope(s) of the credentials being requested. private_key_password: string, password for private_key, unused if private_key is in PEM format. user_agent: string, HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. kwargs: kwargs, Additional parameters to add to the JWT token, for example sub=joe@xample.org.""" super(SignedJwtAssertionCredentials, self).__init__( None, user_agent=user_agent, token_uri=token_uri, revoke_uri=revoke_uri, ) self.scope = util.scopes_to_string(scope) # Keep base64 encoded so it can be stored in JSON. self.private_key = base64.b64encode(private_key) self.private_key_password = private_key_password self.service_account_name = service_account_name self.kwargs = kwargs
Example #24
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #25
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def _get_application_default_credential_from_file(filename): """Build the Application Default Credentials from file.""" # read the credentials from the file with open(filename) as file_obj: client_credentials = json.load(file_obj) credentials_type = client_credentials.get('type') if credentials_type == AUTHORIZED_USER: required_fields = set(['client_id', 'client_secret', 'refresh_token']) elif credentials_type == SERVICE_ACCOUNT: required_fields = set(['client_id', 'client_email', 'private_key_id', 'private_key']) else: raise ApplicationDefaultCredentialsError( "'type' field should be defined (and have one of the '" + AUTHORIZED_USER + "' or '" + SERVICE_ACCOUNT + "' values)") missing_fields = required_fields.difference(client_credentials.keys()) if missing_fields: _raise_exception_for_missing_fields(missing_fields) if client_credentials['type'] == AUTHORIZED_USER: return GoogleCredentials( access_token=None, client_id=client_credentials['client_id'], client_secret=client_credentials['client_secret'], refresh_token=client_credentials['refresh_token'], token_expiry=None, token_uri=GOOGLE_TOKEN_URI, user_agent='Python client library') else: # client_credentials['type'] == SERVICE_ACCOUNT from oauth2client.service_account import ServiceAccountCredentials return ServiceAccountCredentials.from_json_keyfile_dict( client_credentials)
Example #26
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #27
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def _get_application_default_credential_from_file(filename): """Build the Application Default Credentials from file.""" # read the credentials from the file with open(filename) as file_obj: client_credentials = json.load(file_obj) credentials_type = client_credentials.get('type') if credentials_type == AUTHORIZED_USER: required_fields = set(['client_id', 'client_secret', 'refresh_token']) elif credentials_type == SERVICE_ACCOUNT: required_fields = set(['client_id', 'client_email', 'private_key_id', 'private_key']) else: raise ApplicationDefaultCredentialsError( "'type' field should be defined (and have one of the '" + AUTHORIZED_USER + "' or '" + SERVICE_ACCOUNT + "' values)") missing_fields = required_fields.difference(client_credentials.keys()) if missing_fields: _raise_exception_for_missing_fields(missing_fields) if client_credentials['type'] == AUTHORIZED_USER: return GoogleCredentials( access_token=None, client_id=client_credentials['client_id'], client_secret=client_credentials['client_secret'], refresh_token=client_credentials['refresh_token'], token_expiry=None, token_uri=GOOGLE_TOKEN_URI, user_agent='Python client library') else: # client_credentials['type'] == SERVICE_ACCOUNT from oauth2client.service_account import ServiceAccountCredentials return ServiceAccountCredentials.from_json_keyfile_dict( client_credentials)
Example #28
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type
Example #29
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def _get_application_default_credential_from_file(filename): """Build the Application Default Credentials from file.""" # read the credentials from the file with open(filename) as file_obj: client_credentials = json.load(file_obj) credentials_type = client_credentials.get('type') if credentials_type == AUTHORIZED_USER: required_fields = set(['client_id', 'client_secret', 'refresh_token']) elif credentials_type == SERVICE_ACCOUNT: required_fields = set(['client_id', 'client_email', 'private_key_id', 'private_key']) else: raise ApplicationDefaultCredentialsError( "'type' field should be defined (and have one of the '" + AUTHORIZED_USER + "' or '" + SERVICE_ACCOUNT + "' values)") missing_fields = required_fields.difference(client_credentials.keys()) if missing_fields: _raise_exception_for_missing_fields(missing_fields) if client_credentials['type'] == AUTHORIZED_USER: return GoogleCredentials( access_token=None, client_id=client_credentials['client_id'], client_secret=client_credentials['client_secret'], refresh_token=client_credentials['refresh_token'], token_expiry=None, token_uri=GOOGLE_TOKEN_URI, user_agent='Python client library') else: # client_credentials['type'] == SERVICE_ACCOUNT from oauth2client.service_account import ServiceAccountCredentials return ServiceAccountCredentials.from_json_keyfile_dict( client_credentials)
Example #30
Source File: client.py From luci-py with Apache License 2.0 | 5 votes |
def __init__(self, assertion_type, user_agent=None, token_uri=GOOGLE_TOKEN_URI, revoke_uri=GOOGLE_REVOKE_URI, **unused_kwargs): """Constructor for AssertionFlowCredentials. Args: assertion_type: string, assertion type that will be declared to the auth server user_agent: string, The HTTP User-Agent to provide for this application. token_uri: string, URI for token endpoint. For convenience defaults to Google's endpoints but any OAuth 2.0 provider can be used. revoke_uri: string, URI for revoke endpoint. """ super(AssertionCredentials, self).__init__( None, None, None, None, None, token_uri, user_agent, revoke_uri=revoke_uri) self.assertion_type = assertion_type