diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-02 13:46:11 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-02 13:46:11 -0300 |
commit | 3501a67aa1b801f6bab52a20ff5bcfc08d9fd25a (patch) | |
tree | 080fd6c30ed72c6368f82b73360d42bfa3ac0cec /src/leap/bitmask/services/__init__.py | |
parent | 1a2f257cc2f15e3a3ad84c643c2e78ff58972b45 (diff) | |
parent | 5b2220bc0177f12c81a3dbb1ebffd3cdae8b350d (diff) |
Merge remote-tracking branch 'chiiph/feature/use_token' into develop
Diffstat (limited to 'src/leap/bitmask/services/__init__.py')
-rw-r--r-- | src/leap/bitmask/services/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/leap/bitmask/services/__init__.py b/src/leap/bitmask/services/__init__.py index 9b32c5ad..f9456159 100644 --- a/src/leap/bitmask/services/__init__.py +++ b/src/leap/bitmask/services/__init__.py @@ -126,10 +126,15 @@ def download_service_config(provider_config, service_config, # XXX make and use @with_srp_auth decorator srp_auth = SRPAuth(provider_config) session_id = srp_auth.get_session_id() + token = srp_auth.get_token() cookies = None - if session_id: + if session_id is not None: cookies = {"_session_id": session_id} + # API v2 will only support token auth, but in v1 we can send both + if token is not None: + headers["Authorization"] = 'Token token="{0}"'.format(token) + res = session.get(config_uri, verify=provider_config.get_ca_cert_path(), headers=headers, |