Reputation: 12607
I'm using social-auth-app-django
to support logins with social apps.
This code is on a angular-djangorest app, so basically the django doesn't serve the html pages.
Now from the docs, I can see that if I did serve the html pages, I would simply add the following line to generate the 'connect with' link:
<a href="{% url 'social:begin' 'instagram' %}">Login with Instagram</a>
but since I don't serve the html myself, I need to supply the angular app the string generated between the {% %}
myself.
For example
def connect_with_instagram(request):
.
.
return HttpResponseRedirect(<the 'connect with' string>)
So how can I generate this string?
Upvotes: 0
Views: 40
Reputation: 844
{% url 'social:begin' 'instagram' %}
in normal django python code would be:
from django.urls import reverse
reverse('social:begin', args=['instagram'])
ending up like this:
from django.urls import reverse
def connect_with_instagram(request):
.
.
return HttpResponseRedirect(reverse('social:begin', args=['instagram']))
Upvotes: 1