Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

Commit 704337e

Browse files
committed
Use 'scheme' not 'prefix' for TokenAuthentication.
1 parent f719334 commit 704337e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

coreapi/auth.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ def __call__(self, request):
1818

1919
class TokenAuthentication(AuthBase):
2020
allow_cookies = False
21-
prefix = 'Bearer'
21+
scheme = 'Bearer'
2222

23-
def __init__(self, token, prefix=None, domain=None):
23+
def __init__(self, token, scheme=None, domain=None):
2424
"""
2525
* Use an unauthenticated client, and make a request to obtain a token.
2626
* Create an authenticated client using eg. `TokenAuthentication(token="<token>")`
2727
"""
2828
self.token = token
2929
self.domain = domain
30-
if prefix is not None:
31-
self.prefix = prefix
30+
if scheme is not None:
31+
self.scheme = scheme
3232

3333
def __call__(self, request):
3434
if not domain_matches(request, self.domain):
3535
return request
3636

37-
request.headers['Authorization'] = '%s %s' % (self.prefix, self.token)
37+
request.headers['Authorization'] = '%s %s' % (self.scheme, self.token)
3838
return request
3939

4040

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy