Skip to content

Commit

Permalink
Merge pull request #265 from semantic-systems/enhancements
Browse files Browse the repository at this point in the history
preferred url scheme
  • Loading branch information
abdullah-rana authored Nov 28, 2024
2 parents 4ded8ef + 829441a commit 24981b7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
app.config.from_object(Config)
Session(app)

app.config.update(dict(
PREFERRED_URL_SCHEME = os.environ.get('PREFERRED_URL_SCHEME', 'https')
))

login_manager = LoginManager(app)
login_manager.login_view = 'login'

Expand Down Expand Up @@ -270,7 +266,7 @@ def oauth2_authorize(provider):
qs = urlencode({
'client_id': provider_data['client_id'],
'redirect_uri': url_for('oauth2_callback', provider=provider,
_external=True),
_external=True, _scheme=os.environ.get('PREFERRED_URL_SCHEME', 'https')),
'response_type': 'code',
'scope': ' '.join(provider_data['scopes']),
'state': session['oauth2_state'],
Expand Down Expand Up @@ -311,7 +307,7 @@ def oauth2_callback(provider):
'code': request.args['code'],
'grant_type': 'authorization_code',
'redirect_uri': url_for('oauth2_callback', provider=provider,
_external=True),
_external=True, _scheme=os.environ.get('PREFERRED_URL_SCHEME', 'https')),
}, headers={'Accept': 'application/json'})
if response.status_code != 200:
abort(401)
Expand Down

0 comments on commit 24981b7

Please sign in to comment.