Compare commits

...

1 Commits

Author SHA1 Message Date
vuko 43342893fd migrating from abandoned flask-oauthlib to authlib 2020-11-08 17:57:01 +01:00
2 changed files with 4 additions and 4 deletions

View File

@ -32,5 +32,5 @@ setup(
'Topic :: Software Development :: Libraries :: Python Modules'
],
packages=['spaceauth'],
install_requires=['Flask-OAuthlib>=0.9.4', 'Flask-Login>=0.4', 'requests>=2.0', 'blinker'],
install_requires=['authlib', 'Flask-Login>=0.4', 'requests>=2.0', 'blinker'],
)

View File

@ -1,5 +1,5 @@
from flask import Blueprint, request, url_for, session, redirect, abort, flash
from flask_oauthlib.client import OAuth, OAuthException
from authlib.integrations.flask_client import OAuth, OAuthError
from flask_login import LoginManager, login_user, logout_user, current_user, login_required, UserMixin
from spaceauth.caps import cap_required
@ -35,7 +35,7 @@ class SpaceAuth(LoginManager):
super(SpaceAuth, self).init_app(app)
app.register_blueprint(self.blueprint, url_prefix=url_prefix)
@app.errorhandler(OAuthException)
@app.errorhandler(OAuthError)
def errorhandler(err):
flash('OAuth error occured', 'error')
return redirect('/')
@ -56,7 +56,7 @@ class SpaceAuth(LoginManager):
def callback_view_handler(self):
resp = self.remote.authorized_response()
if resp is None:
raise OAuthException(
raise OAuthError(
'Access denied', type=request.args.get('error'))
# TODO encrypt token...?