| 1 |
X/Twitter (OAuth 2) |
| 2 |
------------------- |
| 3 |
|
| 4 |
You will need to create an X app with OAuth 2.0 enabled and configure the X provider for |
| 5 |
your Django application via the admin interface. |
| 6 |
|
| 7 |
App registration |
| 8 |
**************** |
| 9 |
|
| 10 |
To register an app on X you will need an X account. With an account, you can |
| 11 |
create a new app via:: |
| 12 |
|
| 13 |
https://developer.x.com/en/portal/dashboard |
| 14 |
|
| 15 |
In the app creation form fill in the development callback URL:: |
| 16 |
|
| 17 |
http://127.0.0.1:8000/accounts/twitter_oauth2/login/callback/ |
| 18 |
|
| 19 |
For production use a callback URL such as:: |
| 20 |
|
| 21 |
http://{{yourdomain}}.com/accounts/twitter_oauth2/login/callback/ |
| 22 |
|
| 23 |
|
| 24 |
App database configuration through admin |
| 25 |
**************************************** |
| 26 |
|
| 27 |
The second part of setting up the X provider requires you to configure |
| 28 |
your Django application. Configuration is done by creating a SocialApp object |
| 29 |
in the admin. Add a social app on the admin page:: |
| 30 |
|
| 31 |
/admin/socialaccount/socialapp/ |
| 32 |
|
| 33 |
Use the X keys tab of your application to fill in the form. It's located:: |
| 34 |
|
| 35 |
https://developer.x.com/en/portal/projects/{project-id}/apps/{app-id}/keys |
| 36 |
|
| 37 |
The configuration is as follows: |
| 38 |
|
| 39 |
* Provider ID: "twitter_oauth2" |
| 40 |
* Name, your pick, suggest "X" |
| 41 |
* Client id, is called "OAuth2.0 Client ID" on X |
| 42 |
* Secret key, is called "OAuth2.0 Client Secret" on X |
| 43 |
* Key, is not needed, leave blank |