Skip to content

Commit 18fdce3

Browse files
Updated basic auth examples
1 parent e2897ac commit 18fdce3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Diff for: source/includes/wp-api-v1/_authentication.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ var WooCommerce = new WooCommerceAPI({
234234
consumerSecret: 'consumer_secret',
235235
wp_api: true,
236236
version: 'wc/v1',
237-
queryStringAuth: true // When true and using under HTTPS force Basic Authentication as query string
237+
queryStringAuth: true // Force Basic Authentication as query string true and using under HTTPS
238238
});
239239
```
240240

@@ -251,12 +251,25 @@ $woocommerce = new Client(
251251
[
252252
'wp_api' => true,
253253
'version' => 'wc/v1',
254-
'query_string_auth' => true // When true and using under HTTPS force Basic Authentication as query string
254+
'query_string_auth' => true // Force Basic Authentication as query string true and using under HTTPS
255255
]
256256
);
257257
?>
258258
```
259259

260+
```python
261+
from woocommerce import API
262+
263+
wcapi = API(
264+
url="https://example.com",
265+
consumer_key="consumer_key",
266+
consumer_secret="consumer_secret",
267+
wp_api=True,
268+
version="wc/v1",
269+
query_string_auth=True // Force Basic Authentication as query string true and using under HTTPS
270+
)
271+
```
272+
260273
## Authentication over HTTP ##
261274

262275
You must use [OAuth 1.0a "one-legged" authentication](http://tools.ietf.org/html/rfc5849) to ensure REST API credentials cannot be intercepted by an attacker. Typically you will use any standard OAuth 1.0a library in the language of your choice to handle the authentication, or generate the necessary parameters by following the following instructions.

0 commit comments

Comments
 (0)