Skip to content

Commit 1e137d5

Browse files
Fix: Relax OAuth scope validation to prevent 500 errors with Authentik
Sets OAUTHLIB_RELAX_TOKEN_SCOPE environment variable to allow providers to return fewer scopes than requested without raising an exception.
1 parent 00f07a3 commit 1e137d5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cps/oauth_bb.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@
3333

3434
import json
3535
import requests
36+
import os
3637
from functools import wraps
3738

39+
# Relax OAuthlib scope validation to prevent errors when providers return different scopes
40+
# This fixes Issue #715 where missing 'groups' scope causes 500 Internal Server Error
41+
os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE'] = '1'
42+
3843
from flask import session, request, make_response, abort
3944
from flask import Blueprint, flash, redirect, url_for
4045
from flask_babel import gettext as _

0 commit comments

Comments
 (0)