Hi Derek,
If you are using Django OAuth Toolkit there is authorization URL in this path: /o/authorize Regards,
Aldian Fazrihady
On Thu, Jun 27, 2019 at 10:15 AM Derek Dong <philip623.derek@gmail.com> wrote:
So I've been trying to learn how to authenticate users in my Django application with OAuth.--The token provider has already been established, and the provided documentation is here: https://ion.readthedocs.io/en/latest/developing/oauth.htmlHowever, once I've followed the instructions in the "Python" part I got confused. I successfully logged in using my Ion account, but when I went to the admin page (localhost:8000/admin)I got __init__() missing 1 required positional argument: 'strategy'views.py:def login(request):
oauth = OAuth2Session("SsRYDH1iY6jqLO6rSVnF3A1NtYz4Y3fiO9qUMNAX", redirect_uri="http://127.0.0.1:8000/callback",scope=["read", "write"])
authorization_url, state = oauth.authorization_url("https://ion.tjhsst.edu/oauth/authorize/")
return redirect(authorization_url)
def callback(request):
oauth = OAuth2Session("SsRYDH1iY6jqLO6rSVnF3A1NtYz4Y3fiO9qUMNAX", redirect_uri="http://127.0.0.1:8000/callback", scope=["read", "write"])
code = request.GET.get('code', None)
token = oauth.fetch_token("https://ion.tjhsst.edu/oauth/token/", code=code, client_secret="H78F4vUYd1uTtRSQcCWm0IrSesEhRAXNNh2JRe8KG0LyaJAPY2cPFhIQtKfzqKtMNk6vQxbuOAW2WfedjyNdJ4TLobwKh3NLfe2Am9NNL95T28XTPZWItLqRLKnJOdDu")
return render(request, 'index.html')urls.py:path(r'oauth/', views.login, name='login'),
path(r'callback/', views.callback, name='callback'),settings.py:INSTALLED_APPS = (...
'users.apps.UsersConfig',
'ion_oauth',
)How am I supposed to do this? I had already implemented an internal login/logout system through Django's forms, but I want to authenticate it through the provided servers. Thanks!
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7022da04-ff84-400b-8e24-78327417d4f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAN7EoAbmiePG6R3JV96z_HkZm1kFi_6eCyeEH6%2Bd0J9JLEMNxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment