70 lines
2.3 KiB
Markdown
70 lines
2.3 KiB
Markdown
# Social Auth notes
|
|
|
|
## basic python_social_auth
|
|
|
|
### How to Add Social Login to Django
|
|
[How to Add Social Login to Django](https://simpleisbetterthancomplex.com/tutorial/2016/10/24/how-to-add-social-login-to-django.html)
|
|
|
|
#### pre test notes
|
|
1. disable 'test_social.middleware.ForwardHQMiddleware'
|
|
2. reset LOGIN_REDIRECT_URL = '/tsoc' or to wherever you want it to land
|
|
3. set SOCIAL_AUTH_URL_NAMESPACE = 'social'
|
|
4. DON'T use localhost if you plan on using twitter, twitter doesn't like it
|
|
|
|
#### error in login
|
|
[stackoverflow desc](https://stackoverflow.com/questions/46975657/attributeerror-module-django-contrib-auth-views-has-no-attribute-login)
|
|
|
|
change:
|
|
`path('login/', views.login, name='login')`
|
|
`path('login/', views.LoginView.as_view(template_name="registration/login.django"), name='login')`
|
|
|
|
#### when making callback urls
|
|
- you can use localhost
|
|
- you can also specify a port on localhost, e.g. http://localhost:8026
|
|
- you can also use minyanfinder.stg or any .stg
|
|
|
|
- make sure to specify the "u" letter in oauth
|
|
- make sure to add the final forward slash "/" at the end of the callback url
|
|
|
|
`minyanfinder.stg/oauth/complete/twitter/`
|
|
|
|
|
|
|
|
## global variables
|
|
global variables should be in settings.py
|
|
|
|
local info like the specific client id/secret key, etc, should be in the local setting sfiles
|
|
|
|
test_social should only be activated in the local setting files
|
|
|
|
|
|
### twitter notes
|
|
1. you want to either use http or https, be specific
|
|
2. twitter does not use localhost and forwardhq is buggy
|
|
3. twitter DOES register 127.0.0.1:8026 as a callback
|
|
|
|
|
|
### facebook notes
|
|
|
|
1. can use localhost
|
|
2. minaynfinder.stg is not working, need a certificate of some kind
|
|
3. forwardhq also not working
|
|
|
|
#### using a domain
|
|
|
|
##### create registered users
|
|
|
|
Go to Roles->Test Users
|
|
|
|
##### create the ssl
|
|
1. set a registered domain name to point at the ip address (ie ronnyabraham.com)
|
|
2. create a [https://www.digitalocean.com/community/tutorials/openssl-essentials-working-with-ssl-certificates-private-keys-and-csrs#generating-ssl-certificates](crt certificate)
|
|
|
|
3. `Settings->Basic-> App Domains` add `ronnyabraham.com`
|
|
4. `Settings->Basic->Website/Site URL` add `https://ronnyabraham.com`
|
|
5. in Products->FacebookLogin->Settings add the following to "VAlid OAuth Redirect URIs"
|
|
|
|
- https://ronnyabraham.com
|
|
- https://ronnyabraham.com/oauth/complete/facebook/
|
|
|
|
6. use letsencrypt to create ssl keys
|