api-sandbox/share/readmes/authorization_drf_facebook.md

61 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2025-04-22 18:06:11 +03:00
## main info
https://medium.com/scalereal/the-ultimate-guide-to-using-social-login-in-django-f0abe0022ab0
### facebook settings
#### these settings are needed for csrf to work
ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'
[source for account default setting](https://stackoverflow.com/questions/55666103/django-allauth-facebook-integration-login-failure)
CSRF_TRUSTED_ORIGINS = ['https://oauth.drftesting.net']
ALLOWED_HOSTS = ['https://oauth.drftesting.net']
#### settings in facebook developer apps
##### in app settings / basic
app settings->basic
###### app domains
add the top level domain and the full domain. should look like
drftesting.net
oauth.drftesting.net
go a little further down and click on the button that says "add platform"
###### Site URL
put the full site url in with "https"
https://oauth.drftesting.net/
##### under products
products->facebook login->configure (dropdown) -> settings
set Embedded Browser OAuth Login to yes
##### in Valid OAuth Redirect URIs add the callback url:
example url:
https://oauth.drftesting.net/accounts/facebook/login/callback/
######source on creating and setting up a facebook app
[configure facebook login](https://help.sharetribe.com/en/articles/666072-configure-facebook-login)
######django alluth doc on how to configure callback
[django allauth callback](https://django-allauth.readthedocs.io/en/latest/socialaccount/providers/index.html?highlight=callback)
## how to get a test authentication token
https://developers.facebook.com/docs/marketing-apis/overview/authentication/