Skip to content

Commit 273d3d7

Browse files
committed
add basic auth snippets to the readme
1 parent 34247b9 commit 273d3d7

2 files changed

Lines changed: 49 additions & 33 deletions

File tree

README.rst

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,6 @@ Auth0 - Python
66

77
In this repository, you'll find all the information about integrating Auth0 with Python.
88

9-
10-
==============
11-
What is Auth0?
12-
==============
13-
14-
Auth0 helps you to:
15-
16-
* Add authentication with `multiple authentication sources <https://auth0.com/docs/identityproviders>`_,
17-
either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, among others**,
18-
or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**.
19-
* Add authentication through more traditional `username/password databases <https://auth0.com/docs/connections/database/mysql>`_.
20-
* Add support for `linking different user accounts <https://auth0.com/docs/link-accounts>`_ with the same user.
21-
* Support for generating signed `JSON Web Tokens <https://auth0.com/docs/jwt>`_ to call your APIs and **flow the user identity** securely.
22-
* Analytics of how, when and where users are logging in.
23-
* Pull data from other sources and add it to the user profile, through `JavaScript rules <https://auth0.com/docs/rules>`_.
24-
25-
26-
===========================
27-
Create a free Auth0 Account
28-
===========================
29-
30-
1. Go to `Auth0`_ and click Sign Up.
31-
2. Use Google, GitHub or Microsoft Account to log in.
32-
339
============
3410
Installation
3511
============
@@ -62,7 +38,30 @@ For example:
6238
6339
social = Social('myaccount.auth0.com')
6440
65-
s.login(client_id='...', access_token='...', connection='facebook')
41+
social.login(client_id='...', access_token='...', connection='facebook')
42+
43+
44+
If you need to sign up a user using their email and password, you can use the Database object.
45+
46+
.. code-block:: python
47+
48+
from auth0.v3.authentication import Database
49+
50+
database = Database('myaccount.auth0.com'')
51+
52+
database.signup(client_id='...', email='user@domain.com', password='secr3t', connection='Username-Password-Authentication')
53+
54+
55+
If you need to authenticate a user using their email and password, you can use the GetToken object, which gives you access to requests made against the /oauth/token endpoint.
56+
57+
.. code-block:: python
58+
59+
from auth0.v3.authentication import GetToken
60+
61+
token = GetToken('myaccount.auth0.com')
62+
63+
token.login(client_id='...', client_secret='...', username='user@domain.com', password='secr3t', realm='Username-Password-Authentication')
64+
6665
6766
===================
6867
ID Token validation
@@ -234,7 +233,8 @@ Available Authentication Endpoints
234233
- Social ( ``authentication.Social`` )
235234
- API Authorization - Get Token ( ``authentication.GetToken``)
236235
- API Authorization - Authorization Code Grant (``authentication.AuthorizeClient``)
237-
   
236+
237+
238238
Available Management Endpoints
239239
==============================
240240
@@ -276,11 +276,27 @@ If you have found a bug or if you have a feature request, please report them at
276276
Please do not report security vulnerabilities on the public GitHub issue tracker.
277277
The `Responsible Disclosure Program <https://auth0.com/whitehat>`_ details the procedure for disclosing security issues.
278278
279-
======
280-
Author
281-
======
279+
==============
280+
What is Auth0?
281+
==============
282+
283+
Auth0 helps you to:
282284
283-
`Auth0`_
285+
* Add authentication with `multiple authentication sources <https://auth0.com/docs/identityproviders>`_,
286+
either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, among others**,
287+
or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**.
288+
* Add authentication through more traditional `username/password databases <https://auth0.com/docs/connections/database/mysql>`_.
289+
* Add support for `linking different user accounts <https://auth0.com/docs/link-accounts>`_ with the same user.
290+
* Support for generating signed `JSON Web Tokens <https://auth0.com/docs/jwt>`_ to call your APIs and **flow the user identity** securely.
291+
* Analytics of how, when and where users are logging in.
292+
* Pull data from other sources and add it to the user profile, through `JavaScript rules <https://auth0.com/docs/rules>`_.
293+
294+
===========================
295+
Create a free Auth0 Account
296+
===========================
297+
298+
1. Go to `Auth0 <https://auth0.com/>`_ and click Sign Up.
299+
2. Use Google, GitHub or Microsoft Account to log in.
284300
285301
=======
286302
License

auth0/v3/authentication/get_token.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class GetToken(AuthenticationBase):
55

6-
"""Oauth/token related endpoints
6+
"""/oauth/token related endpoints
77
88
Args:
99
domain (str): Your auth0 domain (e.g: username.auth0.com)
@@ -116,7 +116,7 @@ def client_credentials(self, client_id, client_secret, audience,
116116

117117
def login(self, client_id, client_secret, username, password, scope, realm,
118118
audience, grant_type='http://auth0.com/oauth/grant-type/password-realm'):
119-
"""Calls oauth/token endpoint with password-realm grant type
119+
"""Calls /oauth/token endpoint with password-realm grant type
120120
121121
122122
This is the OAuth 2.0 grant that highly trusted apps utilize in order
@@ -165,7 +165,7 @@ def login(self, client_id, client_secret, username, password, scope, realm,
165165
)
166166

167167
def refresh_token(self, client_id, client_secret, refresh_token, grant_type='refresh_token'):
168-
"""Calls oauth/token endpoint with refresh token grant type
168+
"""Calls /oauth/token endpoint with refresh token grant type
169169
170170
Use this endpoint to refresh an access token, using the refresh token you got during authorization.
171171

0 commit comments

Comments
 (0)