question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get login url in code, rather than templates?

See original GitHub issue

Is there a way to get the login URL that social auth uses to initial a login, for use in Python code rather than in some specific framework’s templating language?

Django’s template uses <a href="{% url "social:begin" "google-oauth2" %}">Google+</a> but it would be super useful (for third party, proxied logins) to be able to call that url("social:begin", "google-oauth2") with some kind of namespacing so that the url(...) function name doesn’t collide.

How/where can this function be imported/called from?

(And would it be possible to put this in the docs for future searcher-of-information?)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
omabcommented, May 22, 2017

reverse() is the opposite, you give it a view name and it will give you the path to it:

> from django.urls import reverse
> reverse("social:begin", args=["google-oauth2"])
u'/login/google-oauth2/'
0reactions
Pomaxcommented, May 22, 2017

thanks. I didn’t use the right call with reverse() then!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to properly get url for the login view in template?
You should use the name of the url, instead of its dotted path. ... urls file, you can see that the name of...
Read more >
Bootstrap Login Form - free examples, templates & tutorial
Responsive login form built with Bootstrap 5. Collection of examples for signup forms, full page login templates, login modals & many other sign...
Read more >
wp_login_url() | Function - WordPress Developer Resources
Retrieves the login URL.
Read more >
40 Best Login Page Examples and Responsive Templates ...
A list of elegant and exquisite login page examples and free responsive login form templates built with HTML and CSS for your next...
Read more >
Customize New Universal Login Pages - Auth0
Learn how to create login page templates for the New Universal Login experience.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found