| 1 |
X/Twitter (OAuth 1) |
| 2 |
------------------- |
| 3 |
|
| 4 |
You will need to create an X app and configure the X provider for your Django |
| 5 |
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/apps/new |
| 14 |
|
| 15 |
In the app creation form fill in the development callback URL:: |
| 16 |
|
| 17 |
http://127.0.0.1:8000/accounts/twitter/login/callback/ |
| 18 |
|
| 19 |
X won't allow using http://localhost:8000. |
| 20 |
|
| 21 |
For production use a callback URL such as:: |
| 22 |
|
| 23 |
http://{{yourdomain}}.com/accounts/twitter/login/callback/ |
| 24 |
|
| 25 |
To allow users to login without authorizing each session, select "Allow this |
| 26 |
application to be used to Sign in with X" under the application's |
| 27 |
"Settings" tab. |
| 28 |
|
| 29 |
App database configuration through admin |
| 30 |
**************************************** |
| 31 |
|
| 32 |
The second part of setting up the X provider requires you to configure |
| 33 |
your Django application. Configuration is done by creating a Socialapp object |
| 34 |
in the admin. Add a social app on the admin page:: |
| 35 |
|
| 36 |
/admin/socialaccount/socialapp/ |
| 37 |
|
| 38 |
Use the X keys tab of your application to fill in the form. It's located:: |
| 39 |
|
| 40 |
https://developer.x.com/en/portal/apps/{{yourappid}}/keys |
| 41 |
|
| 42 |
The configuration is as follows: |
| 43 |
|
| 44 |
* Provider ID: "twitter" |
| 45 |
* Name, your pick, suggest "X" |
| 46 |
* Client id, is called "Consumer Key (API Key)" on X |
| 47 |
* Secret key, is called "Consumer Secret (API Secret)" on X |
| 48 |
* Key, is not needed, leave blank |