mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 12:00:12 +03:00
Tried token authentication today and found those small errors. If it really should have ben JWT and you are using djangorestframework-simplejwt then the action should look more like this:
action = ['auth', 'token', 'obtain', 'create']
This commit is contained in:
parent
8c47a875ec
commit
83cbff3331
|
@ -269,12 +269,12 @@ For example, using the "Django REST framework JWT" package
|
|||
client = coreapi.Client()
|
||||
schema = client.get('https://api.example.org/')
|
||||
|
||||
action = ['api-token-auth', 'obtain-token']
|
||||
params = {username: "example", email: "example@example.com"}
|
||||
action = ['api-token-auth', 'create']
|
||||
params = {"username": "example", "password": "secret"}
|
||||
result = client.action(schema, action, params)
|
||||
|
||||
auth = coreapi.auth.TokenAuthentication(
|
||||
scheme='JWT',
|
||||
scheme='Token',
|
||||
token=result['token']
|
||||
)
|
||||
client = coreapi.Client(auth=auth)
|
||||
|
|
Loading…
Reference in New Issue
Block a user