Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
31106356
Commit
31106356
authored
Aug 15, 2017
by
Carlton Gibson
Committed by
Tom Christie
Aug 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update JS constructor syntax (#5332)
Fixes #5247
parent
bf4b3ff0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
docs/topics/api-clients.md
+5
-5
No files found.
docs/topics/api-clients.md
View file @
31106356
...
@@ -408,7 +408,7 @@ The `coreapi` library, and the `schema` object will now both be available on the
...
@@ -408,7 +408,7 @@ The `coreapi` library, and the `schema` object will now both be available on the
In order to interact with the API you'll need a client instance.
In order to interact with the API you'll need a client instance.
var client = coreapi.Client()
var client =
new
coreapi.Client()
Typically you'll also want to provide some authentication credentials when
Typically you'll also want to provide some authentication credentials when
instantiating the client.
instantiating the client.
...
@@ -423,7 +423,7 @@ the user to login, and then instantiate a client using session authentication:
...
@@ -423,7 +423,7 @@ the user to login, and then instantiate a client using session authentication:
csrfCookieName: 'csrftoken',
csrfCookieName: 'csrftoken',
csrfHeaderName: 'X-CSRFToken'
csrfHeaderName: 'X-CSRFToken'
})
})
let client = coreapi.Client({auth: auth})
let client =
new
coreapi.Client({auth: auth})
The authentication scheme will handle including a CSRF header in any outgoing
The authentication scheme will handle including a CSRF header in any outgoing
requests for unsafe HTTP methods.
requests for unsafe HTTP methods.
...
@@ -437,7 +437,7 @@ The `TokenAuthentication` class can be used to support REST framework's built-in
...
@@ -437,7 +437,7 @@ The `TokenAuthentication` class can be used to support REST framework's built-in
scheme: 'JWT'
scheme: 'JWT'
token: '<token>'
token: '<token>'
})
})
let client = coreapi.Client({auth: auth})
let client =
new
coreapi.Client({auth: auth})
When using TokenAuthentication you'll probably need to implement a login flow
When using TokenAuthentication you'll probably need to implement a login flow
using the CoreAPI client.
using the CoreAPI client.
...
@@ -448,7 +448,7 @@ request to an "obtain token" endpoint
...
@@ -448,7 +448,7 @@ request to an "obtain token" endpoint
For example, using the "Django REST framework JWT" package
For example, using the "Django REST framework JWT" package
// Setup some globally accessible state
// Setup some globally accessible state
window.client = coreapi.Client()
window.client =
new
coreapi.Client()
window.loggedIn = false
window.loggedIn = false
function loginUser(username, password) {
function loginUser(username, password) {
...
@@ -475,7 +475,7 @@ The `BasicAuthentication` class can be used to support HTTP Basic Authentication
...
@@ -475,7 +475,7 @@ The `BasicAuthentication` class can be used to support HTTP Basic Authentication
username: '<username>',
username: '<username>',
password: '<password>'
password: '<password>'
})
})
let client = coreapi.Client({auth: auth})
let client =
new
coreapi.Client({auth: auth})
## Using the client
## Using the client
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment