MCPcopy
hub / github.com/authlib/authlib / OAuth

Class OAuth

authlib/integrations/flask_client/__init__.py:11–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class OAuth(BaseOAuth):
12 oauth1_client_cls = FlaskOAuth1App
13 oauth2_client_cls = FlaskOAuth2App
14 framework_integration_cls = FlaskIntegration
15
16 def __init__(self, app=None, cache=None, fetch_token=None, update_token=None):
17 super().__init__(
18 cache=cache, fetch_token=fetch_token, update_token=update_token
19 )
20 self.app = app
21 if app:
22 self.init_app(app)
23
24 def init_app(self, app, cache=None, fetch_token=None, update_token=None):
25 """Initialize lazy for Flask app. This is usually used for Flask application
26 factory pattern.
27 """
28 self.app = app
29 if cache is not None:
30 self.cache = cache
31
32 if fetch_token:
33 self.fetch_token = fetch_token
34 if update_token:
35 self.update_token = update_token
36
37 app.extensions = getattr(app, "extensions", {})
38 app.extensions["authlib.integrations.flask_client"] = self
39
40 def create_client(self, name):
41 if not self.app:
42 raise RuntimeError("OAuth is not init with Flask app.")
43 return super().create_client(name)
44
45 def register(self, name, overwrite=False, **kwargs):
46 self._registry[name] = (overwrite, kwargs)
47 if self.app:
48 return self.create_client(name)
49 return LocalProxy(lambda: self.create_client(name))
50
51
52__all__ = [

Callers 15

test_fetch_userinfoFunction · 0.90
test_parse_id_tokenFunction · 0.90
test_register_remote_appFunction · 0.90
test_init_app_laterFunction · 0.90
test_init_app_paramsFunction · 0.90
test_create_clientFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_fetch_userinfoFunction · 0.72
test_parse_id_tokenFunction · 0.72
test_register_remote_appFunction · 0.72
test_init_app_laterFunction · 0.72
test_init_app_paramsFunction · 0.72
test_create_clientFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…