use indieauth.com as fallback if no authentication_endpoint is provided
This commit is contained in:
parent
b714d8db93
commit
83ac2700c0
|
@ -21,6 +21,8 @@ if sys.version < '3':
|
||||||
else:
|
else:
|
||||||
from urllib.parse import urlencode, parse_qs
|
from urllib.parse import urlencode, parse_qs
|
||||||
|
|
||||||
|
DEFAULT_AUTH_URL = 'https://indieauth.com/auth'
|
||||||
|
|
||||||
|
|
||||||
class MicropubClient:
|
class MicropubClient:
|
||||||
"""Flask-Micropub provides support for IndieAuth/Micropub
|
"""Flask-Micropub provides support for IndieAuth/Micropub
|
||||||
|
@ -117,7 +119,7 @@ class MicropubClient:
|
||||||
me = 'http://' + me
|
me = 'http://' + me
|
||||||
auth_url, token_url, micropub_url = self._discover_endpoints(me)
|
auth_url, token_url, micropub_url = self._discover_endpoints(me)
|
||||||
if not auth_url:
|
if not auth_url:
|
||||||
auth_url = 'https://indieauth.com/auth'
|
auth_url = DEFAULT_AUTH_URL
|
||||||
|
|
||||||
csrf_token = uuid.uuid4().hex
|
csrf_token = uuid.uuid4().hex
|
||||||
flask.session['_micropub_csrf_token'] = csrf_token
|
flask.session['_micropub_csrf_token'] = csrf_token
|
||||||
|
@ -178,10 +180,8 @@ class MicropubClient:
|
||||||
next_url=next_url, error='mismatched CSRF token')
|
next_url=next_url, error='mismatched CSRF token')
|
||||||
|
|
||||||
auth_url = self._discover_endpoints(me)[0]
|
auth_url = self._discover_endpoints(me)[0]
|
||||||
|
|
||||||
if not auth_url:
|
if not auth_url:
|
||||||
return AuthResponse(
|
auth_url = DEFAULT_AUTH_URL
|
||||||
next_url=next_url, error='no authorization endpoint')
|
|
||||||
|
|
||||||
# validate the authorization code
|
# validate the authorization code
|
||||||
auth_data = {
|
auth_data = {
|
||||||
|
|
Loading…
Reference in New Issue