singingwolfboy / flask-dance

Doing the OAuth dance with style using Flask, requests, and oauthlib.
https://pypi.python.org/pypi/Flask-Dance/
MIT License
1.01k stars 158 forks source link

Anyway to return the URL of the provider login page (with params) vs. forcing a redirect? #362

Open bustardo opened 3 years ago

bustardo commented 3 years ago

Hi, Instead of this behavior:

if provider.authorized:
     return { "message" : "success"}, 200
else:
    return redirect(url_for(provider.login))

I'd like to do something like this:

if provider.authorized:
     return { "message" : "success"}, 200
else:
    return  { "message" : "must login to provider", "url" : parameterized_url }, 200

Is there a way to do this that I'm missing?

I know that I can get the URL I'm looking for using the @oauth_before_login.connect decorator , but I still get redirected, so it really does me no good. Is there another way to get that specific url?

The end result I'm going for would open up the parameterized_url via the front end in a new window, so they could login with the provider. Any help would be greatly appreciated as I love using flask-dance!

bustardo commented 3 years ago

I ended up abandoning this approach and retrieved the token and passed it to my backend. Working great so far!