fabric/share/templates/readmes/social_auth.md
2019-06-21 14:56:08 +03:00

45 lines
1.5 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