Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions querybook/server/app/auth/auth0_auth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from env import get_env_config
import certifi

from app.auth.okta_auth import OAUTH_CALLBACK_PATH, OktaLoginManager
from .utils import AuthenticationError


class Auth0LoginManager(OktaLoginManager):
Expand All @@ -11,6 +13,20 @@ def get_oauth_urls(self):
profile_url = f"{auth0_base_url}/userinfo"
return authorization_url, token_url, profile_url

def _fetch_access_token(self, code):
resp = self.oauth_session.fetch_token(
token_url=self.oauth_config["token_url"],
client_id=self.oauth_config["client_id"],
code=code,
client_secret=self.oauth_config["client_secret"],
cert=certifi.where(),
)

if resp is None:
raise AuthenticationError("Null response, denying access.")
return resp["access_token"]



login_manager = Auth0LoginManager()

Expand Down