hyperpocket 0.1.10__tar.gz → 0.2.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/PKG-INFO +11 -5
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/README.md +10 -4
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/__init__.py +4 -4
- hyperpocket-0.2.0/hyperpocket/auth/__init__.py +21 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/calendly/oauth2_handler.py +24 -17
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/calendly/oauth2_schema.py +3 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/context.py +2 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/github/oauth2_handler.py +13 -8
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/github/token_handler.py +27 -21
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/google/context.py +1 -3
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/google/oauth2_context.py +1 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/google/oauth2_handler.py +22 -17
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/gumloop/token_context.py +1 -4
- hyperpocket-0.2.0/hyperpocket/auth/gumloop/token_handler.py +94 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/gumloop/token_schema.py +2 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/handler.py +21 -6
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/linear/token_context.py +2 -5
- hyperpocket-0.2.0/hyperpocket/auth/linear/token_handler.py +92 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/notion/context.py +2 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/notion/token_context.py +2 -4
- hyperpocket-0.2.0/hyperpocket/auth/notion/token_handler.py +89 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/notion/token_schema.py +0 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/reddit/oauth2_handler.py +9 -10
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/reddit/oauth2_schema.py +0 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/schema.py +4 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/slack/oauth2_context.py +3 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/slack/oauth2_handler.py +55 -35
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/slack/token_context.py +2 -4
- hyperpocket-0.2.0/hyperpocket/auth/slack/token_handler.py +87 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/builtin.py +4 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/__main__.py +4 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/auth.py +59 -28
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/codegen/auth/auth_context_template.py +3 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/codegen/auth/auth_token_context_template.py +3 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/codegen/auth/auth_token_handler_template.py +6 -5
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/codegen/auth/auth_token_schema_template.py +3 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/codegen/auth/server_auth_template.py +3 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/pull.py +5 -5
- hyperpocket-0.2.0/hyperpocket/config/__init__.py +4 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/config/auth.py +3 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/config/logger.py +20 -15
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/config/session.py +4 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/config/settings.py +19 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/futures/__init__.py +1 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/futures/futurestore.py +3 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/pocket_auth.py +171 -84
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/pocket_core.py +51 -33
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/pocket_main.py +122 -93
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/prompts.py +2 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/repository/__init__.py +1 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/repository/lock.py +47 -33
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/repository/lockfile.py +2 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/repository/repository.py +1 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/__init__.py +1 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/github.py +2 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/linear.py +1 -3
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/notion.py +2 -5
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/slack.py +1 -3
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/token.py +17 -11
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/proxy.py +29 -13
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/server.py +75 -31
- hyperpocket-0.2.0/hyperpocket/server/tool/dto/script.py +33 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/tool/wasm.py +14 -11
- hyperpocket-0.2.0/hyperpocket/session/__init__.py +8 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/session/in_memory.py +44 -24
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/session/interface.py +42 -24
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/session/redis.py +48 -31
- hyperpocket-0.2.0/hyperpocket/tool/__init__.py +14 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/function/__init__.py +1 -5
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/function/annotation.py +11 -9
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/function/tool.py +37 -27
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/tool.py +59 -36
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/wasm/__init__.py +1 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/wasm/browser.py +15 -10
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/wasm/invoker.py +16 -16
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/wasm/script.py +27 -14
- hyperpocket-0.2.0/hyperpocket/tool/wasm/templates/__init__.py +35 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/wasm/templates/node.py +2 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/wasm/templates/python.py +2 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/wasm/tool.py +27 -14
- hyperpocket-0.2.0/hyperpocket/tool_like.py +5 -0
- hyperpocket-0.2.0/hyperpocket/util/__init__.py +1 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/util/extract_func_param_desc_from_docstring.py +23 -7
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/util/find_all_leaf_class_in_package.py +4 -3
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/util/find_all_subclass_in_package.py +4 -2
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/util/flatten_json_schema.py +10 -6
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/util/function_to_model.py +33 -12
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/util/get_objects_from_subpackage.py +1 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/util/json_schema_to_model.py +14 -5
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/pyproject.toml +3 -20
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/auth/test_google_oauth2_handler.py +30 -22
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/auth/test_gumloop_token_handler.py +13 -9
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/auth/test_notion_token_handler.py +12 -10
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/auth/test_slack_oauth2_handler.py +30 -24
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/auth/test_slack_token_handler.py +12 -10
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/session/test_in_memory.py +11 -7
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/session/test_redis.py +14 -12
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/test_pocket.py +23 -47
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/test_pocket_auth.py +336 -141
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/tool/test_function_tool.py +55 -66
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/tool/test_wasm_tool.py +3 -10
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/utils/test_extract_func_param_desc_from_docstring.py +19 -17
- hyperpocket-0.1.10/hyperpocket/auth/__init__.py +0 -16
- hyperpocket-0.1.10/hyperpocket/auth/gumloop/token_handler.py +0 -66
- hyperpocket-0.1.10/hyperpocket/auth/linear/token_handler.py +0 -68
- hyperpocket-0.1.10/hyperpocket/auth/notion/token_handler.py +0 -65
- hyperpocket-0.1.10/hyperpocket/auth/slack/token_handler.py +0 -64
- hyperpocket-0.1.10/hyperpocket/config/__init__.py +0 -9
- hyperpocket-0.1.10/hyperpocket/server/tool/dto/script.py +0 -28
- hyperpocket-0.1.10/hyperpocket/session/__init__.py +0 -4
- hyperpocket-0.1.10/hyperpocket/tool/__init__.py +0 -14
- hyperpocket-0.1.10/hyperpocket/tool/wasm/templates/__init__.py +0 -28
- hyperpocket-0.1.10/hyperpocket/tool_like.py +0 -5
- hyperpocket-0.1.10/hyperpocket/util/__init__.py +0 -1
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/.gitignore +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/README.md +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/calendly/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/calendly/context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/calendly/oauth2_context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/github/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/github/context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/github/oauth2_context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/github/oauth2_schema.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/github/token_context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/github/token_schema.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/google/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/google/oauth2_schema.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/gumloop/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/gumloop/context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/linear/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/linear/context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/linear/token_schema.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/notion/README.md +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/notion/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/provider.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/reddit/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/reddit/context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/reddit/oauth2_context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/slack/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/slack/context.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/slack/oauth2_schema.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/auth/slack/token_schema.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/codegen/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/codegen/auth/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/eject.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/cli/sync.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/config/git.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/constants.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/calendly.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/google.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/gumloop.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/auth/reddit.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/tool/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/server/tool/dto/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/session/README.md +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/README.md +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/function/README.md +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/tests/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/hyperpocket/tool/wasm/README.md +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/auth/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/session/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/tests/tool/__init__.py +0 -0
- {hyperpocket-0.1.10 → hyperpocket-0.2.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hyperpocket
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: Building AI agent with hyperpocket tool in a flash
|
5
5
|
Project-URL: Homepage, https://vessl-ai.github.io/hyperpocket
|
6
6
|
Project-URL: Repository, https://github.com/vessl-ai/hyperpocket
|
@@ -23,13 +23,14 @@ Requires-Dist: toml>=0.10.2
|
|
23
23
|
Requires-Dist: uvicorn>=0.32.1
|
24
24
|
Description-Content-Type: text/markdown
|
25
25
|
|
26
|
+
<p align="center">
|
27
|
+
<img src="../../logo.png" alt="hyperpocket" width="570"/>
|
28
|
+
</p>
|
29
|
+
|
26
30
|
# Hyperpocket 👛
|
27
31
|
|
28
32
|
Hyperpocket is where tools belong. Power your agent up with a pocket of tools. 👛
|
29
33
|
|
30
|
-
<figure>
|
31
|
-
<img src="../../logo.png" alt="hyperpocket" width="200"/>
|
32
|
-
</figure>
|
33
34
|
|
34
35
|
## Introduction
|
35
36
|
|
@@ -160,13 +161,15 @@ graph_builder.compile()
|
|
160
161
|
```
|
161
162
|
|
162
163
|
```python
|
164
|
+
import os
|
165
|
+
|
163
166
|
from llama_index.core.agent import FunctionCallingAgent
|
164
167
|
from llama_index.llms.openai import OpenAI
|
165
168
|
|
166
169
|
from hyperpocket.config import secret
|
167
170
|
from hyperpocket_llamaindex import PocketLlamaindex
|
168
171
|
|
169
|
-
llm = OpenAI(api_key=
|
172
|
+
llm = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
170
173
|
pocket = PocketLlamaindex(
|
171
174
|
tools=[
|
172
175
|
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
@@ -318,3 +321,6 @@ scopes = []
|
|
318
321
|
)
|
319
322
|
def my_function(**kwargs):
|
320
323
|
```
|
324
|
+
|
325
|
+
## Special thanks
|
326
|
+
- [tott](https://x.com/tott____) for drawing the cute possum in a pocket.
|
@@ -1,10 +1,11 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="../../logo.png" alt="hyperpocket" width="570"/>
|
3
|
+
</p>
|
4
|
+
|
1
5
|
# Hyperpocket 👛
|
2
6
|
|
3
7
|
Hyperpocket is where tools belong. Power your agent up with a pocket of tools. 👛
|
4
8
|
|
5
|
-
<figure>
|
6
|
-
<img src="../../logo.png" alt="hyperpocket" width="200"/>
|
7
|
-
</figure>
|
8
9
|
|
9
10
|
## Introduction
|
10
11
|
|
@@ -135,13 +136,15 @@ graph_builder.compile()
|
|
135
136
|
```
|
136
137
|
|
137
138
|
```python
|
139
|
+
import os
|
140
|
+
|
138
141
|
from llama_index.core.agent import FunctionCallingAgent
|
139
142
|
from llama_index.llms.openai import OpenAI
|
140
143
|
|
141
144
|
from hyperpocket.config import secret
|
142
145
|
from hyperpocket_llamaindex import PocketLlamaindex
|
143
146
|
|
144
|
-
llm = OpenAI(api_key=
|
147
|
+
llm = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
145
148
|
pocket = PocketLlamaindex(
|
146
149
|
tools=[
|
147
150
|
"https://github.com/vessl-ai/hyperpocket/tree/main/tools/slack/get-message",
|
@@ -293,3 +296,6 @@ scopes = []
|
|
293
296
|
)
|
294
297
|
def my_function(**kwargs):
|
295
298
|
```
|
299
|
+
|
300
|
+
## Special thanks
|
301
|
+
- [tott](https://x.com/tott____) for drawing the cute possum in a pocket.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
from hyperpocket.auth.context import AuthContext
|
2
|
+
from hyperpocket.auth.handler import AuthHandlerInterface
|
3
|
+
from hyperpocket.auth.provider import AuthProvider
|
4
|
+
from hyperpocket.util.find_all_leaf_class_in_package import (
|
5
|
+
find_all_leaf_class_in_package,
|
6
|
+
)
|
7
|
+
|
8
|
+
PREBUILT_AUTH_HANDLERS = find_all_leaf_class_in_package(
|
9
|
+
"hyperpocket.auth", AuthHandlerInterface
|
10
|
+
)
|
11
|
+
AUTH_CONTEXT_MAP = {
|
12
|
+
leaf.__name__: leaf
|
13
|
+
for leaf in find_all_leaf_class_in_package("hyperpocket.auth", AuthContext)
|
14
|
+
}
|
15
|
+
|
16
|
+
__all__ = [
|
17
|
+
"PREBUILT_AUTH_HANDLERS",
|
18
|
+
"AUTH_CONTEXT_MAP",
|
19
|
+
"AuthProvider",
|
20
|
+
"AuthHandlerInterface",
|
21
|
+
]
|
@@ -4,7 +4,10 @@ from urllib.parse import urlencode, urljoin
|
|
4
4
|
import httpx
|
5
5
|
|
6
6
|
from hyperpocket.auth.calendly.oauth2_context import CalendlyOAuth2AuthContext
|
7
|
-
from hyperpocket.auth.calendly.oauth2_schema import
|
7
|
+
from hyperpocket.auth.calendly.oauth2_schema import (
|
8
|
+
CalendlyOAuth2Request,
|
9
|
+
CalendlyOAuth2Response,
|
10
|
+
)
|
8
11
|
from hyperpocket.auth.context import AuthContext
|
9
12
|
from hyperpocket.auth.handler import AuthHandlerInterface, AuthProvider
|
10
13
|
from hyperpocket.config import config
|
@@ -16,7 +19,9 @@ class CalendlyOAuth2AuthHandler(AuthHandlerInterface):
|
|
16
19
|
_CALENDLY_TOKEN_URL = "https://auth.calendly.com/oauth/token"
|
17
20
|
|
18
21
|
name: str = "calendly-oauth2"
|
19
|
-
description: str =
|
22
|
+
description: str = (
|
23
|
+
"This handler is used to authenticate users using Calendly OAuth."
|
24
|
+
)
|
20
25
|
scoped: bool = False
|
21
26
|
|
22
27
|
@staticmethod
|
@@ -32,17 +37,17 @@ class CalendlyOAuth2AuthHandler(AuthHandlerInterface):
|
|
32
37
|
return set()
|
33
38
|
|
34
39
|
def prepare(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
self,
|
41
|
+
auth_req: CalendlyOAuth2Request,
|
42
|
+
thread_id: str,
|
43
|
+
profile: str,
|
44
|
+
future_uid: str,
|
45
|
+
*args,
|
46
|
+
**kwargs,
|
42
47
|
) -> str:
|
43
48
|
redirect_uri = urljoin(
|
44
|
-
config.public_base_url + "/",
|
45
|
-
f"{config.callback_url_rewrite_prefix}/auth/calendly/oauth2/callback",
|
49
|
+
config().public_base_url + "/",
|
50
|
+
f"{config().callback_url_rewrite_prefix}/auth/calendly/oauth2/callback",
|
46
51
|
)
|
47
52
|
auth_url = self._make_auth_url(auth_req, redirect_uri, future_uid)
|
48
53
|
|
@@ -58,7 +63,7 @@ class CalendlyOAuth2AuthHandler(AuthHandlerInterface):
|
|
58
63
|
return f"User needs to authenticate using the following URL: {auth_url}"
|
59
64
|
|
60
65
|
async def authenticate(
|
61
|
-
|
66
|
+
self, auth_req: CalendlyOAuth2Request, future_uid: str, *args, **kwargs
|
62
67
|
) -> AuthContext:
|
63
68
|
future_data = FutureStore.get_future(future_uid)
|
64
69
|
auth_code = await future_data.future
|
@@ -97,7 +102,7 @@ class CalendlyOAuth2AuthHandler(AuthHandlerInterface):
|
|
97
102
|
return CalendlyOAuth2AuthContext.from_calendly_oauth2_response(auth_response)
|
98
103
|
|
99
104
|
async def refresh(
|
100
|
-
|
105
|
+
self, auth_req: CalendlyOAuth2Request, context: AuthContext, *args, **kwargs
|
101
106
|
) -> AuthContext:
|
102
107
|
last_oauth2_resp: CalendlyOAuth2Response = context.detail
|
103
108
|
refresh_token = last_oauth2_resp.refresh_token
|
@@ -127,7 +132,9 @@ class CalendlyOAuth2AuthHandler(AuthHandlerInterface):
|
|
127
132
|
response = CalendlyOAuth2Response(**resp_json)
|
128
133
|
return CalendlyOAuth2AuthContext.from_calendly_oauth2_response(response)
|
129
134
|
|
130
|
-
def _make_auth_url(
|
135
|
+
def _make_auth_url(
|
136
|
+
self, auth_req: CalendlyOAuth2Request, redirect_uri: str, state: str
|
137
|
+
):
|
131
138
|
params = {
|
132
139
|
"client_id": auth_req.client_id,
|
133
140
|
"redirect_uri": redirect_uri,
|
@@ -137,10 +144,10 @@ class CalendlyOAuth2AuthHandler(AuthHandlerInterface):
|
|
137
144
|
return f"{self._CALENDLY_AUTH_URL}?{urlencode(params)}"
|
138
145
|
|
139
146
|
def make_request(
|
140
|
-
|
147
|
+
self, auth_scopes: Optional[list[str]] = None, **kwargs
|
141
148
|
) -> CalendlyOAuth2Request:
|
142
149
|
return CalendlyOAuth2Request(
|
143
150
|
auth_scopes=auth_scopes,
|
144
|
-
client_id=config.auth.calendly.client_id,
|
145
|
-
client_secret=config.auth.calendly.client_secret,
|
151
|
+
client_id=config().auth.calendly.client_id,
|
152
|
+
client_secret=config().auth.calendly.client_secret,
|
146
153
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
2
|
from datetime import datetime
|
3
|
-
from typing import
|
3
|
+
from typing import Any, Optional
|
4
4
|
|
5
5
|
from pydantic import BaseModel, Field
|
6
6
|
|
@@ -9,6 +9,7 @@ class AuthContext(BaseModel, ABC):
|
|
9
9
|
"""
|
10
10
|
This class is used to define the interface of the authentication model.
|
11
11
|
"""
|
12
|
+
|
12
13
|
access_token: str = Field(description="user's access token")
|
13
14
|
description: str = Field(description="description of this authentication context")
|
14
15
|
expires_at: Optional[datetime] = Field(description="expiration datetime")
|
@@ -5,7 +5,10 @@ import httpx
|
|
5
5
|
|
6
6
|
from hyperpocket.auth.context import AuthContext
|
7
7
|
from hyperpocket.auth.github.oauth2_context import GitHubOAuth2AuthContext
|
8
|
-
from hyperpocket.auth.github.oauth2_schema import
|
8
|
+
from hyperpocket.auth.github.oauth2_schema import (
|
9
|
+
GitHubOAuth2Request,
|
10
|
+
GitHubOAuth2Response,
|
11
|
+
)
|
9
12
|
from hyperpocket.auth.handler import AuthHandlerInterface, AuthProvider
|
10
13
|
from hyperpocket.config import config
|
11
14
|
from hyperpocket.futures import FutureStore
|
@@ -41,8 +44,8 @@ class GitHubOAuth2AuthHandler(AuthHandlerInterface):
|
|
41
44
|
**kwargs,
|
42
45
|
) -> str:
|
43
46
|
redirect_uri = urljoin(
|
44
|
-
config.public_base_url + "/",
|
45
|
-
f"{config.callback_url_rewrite_prefix}/auth/github/oauth2/callback",
|
47
|
+
config().public_base_url + "/",
|
48
|
+
f"{config().callback_url_rewrite_prefix}/auth/github/oauth2/callback",
|
46
49
|
)
|
47
50
|
auth_url = self._make_auth_url(auth_req, redirect_uri, future_uid)
|
48
51
|
|
@@ -60,7 +63,7 @@ class GitHubOAuth2AuthHandler(AuthHandlerInterface):
|
|
60
63
|
async def authenticate(
|
61
64
|
self, auth_req: GitHubOAuth2Request, future_uid: str, *args, **kwargs
|
62
65
|
) -> AuthContext:
|
63
|
-
future_data = FutureStore.get_future(
|
66
|
+
future_data = FutureStore.get_future(future_uid)
|
64
67
|
auth_code = await future_data.future
|
65
68
|
|
66
69
|
async with httpx.AsyncClient() as client:
|
@@ -124,7 +127,9 @@ class GitHubOAuth2AuthHandler(AuthHandlerInterface):
|
|
124
127
|
response = GitHubOAuth2Response(**resp_json)
|
125
128
|
return GitHubOAuth2AuthContext.from_github_oauth2_response(response)
|
126
129
|
|
127
|
-
def _make_auth_url(
|
130
|
+
def _make_auth_url(
|
131
|
+
self, auth_req: GitHubOAuth2Request, redirect_uri: str, state: str
|
132
|
+
):
|
128
133
|
params = {
|
129
134
|
"client_id": auth_req.client_id,
|
130
135
|
"redirect_uri": redirect_uri,
|
@@ -132,12 +137,12 @@ class GitHubOAuth2AuthHandler(AuthHandlerInterface):
|
|
132
137
|
"state": state,
|
133
138
|
}
|
134
139
|
return f"{self._GITHUB_AUTH_URL}?{urlencode(params)}"
|
135
|
-
|
140
|
+
|
136
141
|
def make_request(
|
137
142
|
self, auth_scopes: Optional[list[str]] = None, **kwargs
|
138
143
|
) -> GitHubOAuth2Request:
|
139
144
|
return GitHubOAuth2Request(
|
140
145
|
auth_scopes=auth_scopes,
|
141
|
-
client_id=config.auth.github.client_id,
|
142
|
-
client_secret=config.auth.github.client_secret,
|
146
|
+
client_id=config().auth.github.client_id,
|
147
|
+
client_secret=config().auth.github.client_secret,
|
143
148
|
)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import Optional
|
2
|
-
from urllib.parse import
|
2
|
+
from urllib.parse import urlencode, urljoin
|
3
3
|
|
4
|
-
from hyperpocket.auth import
|
4
|
+
from hyperpocket.auth import AuthHandlerInterface, AuthProvider
|
5
5
|
from hyperpocket.auth.context import AuthContext
|
6
6
|
from hyperpocket.auth.github.token_context import GitHubTokenAuthContext
|
7
7
|
from hyperpocket.auth.github.token_schema import GitHubTokenRequest, GitHubTokenResponse
|
@@ -17,7 +17,10 @@ class GitHubTokenAuthHandler(AuthHandlerInterface):
|
|
17
17
|
)
|
18
18
|
scoped: bool = False
|
19
19
|
|
20
|
-
_TOKEN_URL: str = urljoin(
|
20
|
+
_TOKEN_URL: str = urljoin(
|
21
|
+
config().public_base_url + "/",
|
22
|
+
f"{config().callback_url_rewrite_prefix}/auth/token",
|
23
|
+
)
|
21
24
|
|
22
25
|
@staticmethod
|
23
26
|
def provider() -> AuthProvider:
|
@@ -28,19 +31,21 @@ class GitHubTokenAuthHandler(AuthHandlerInterface):
|
|
28
31
|
return set()
|
29
32
|
|
30
33
|
def prepare(
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
self,
|
35
|
+
auth_req: AuthenticateRequest,
|
36
|
+
thread_id: str,
|
37
|
+
profile: str,
|
38
|
+
future_uid: str,
|
39
|
+
*args,
|
40
|
+
**kwargs,
|
38
41
|
) -> str:
|
39
42
|
redirect_uri = urljoin(
|
40
|
-
config.public_base_url + "/",
|
41
|
-
f"{config.callback_url_rewrite_prefix}/auth/github/token/callback",
|
43
|
+
config().public_base_url + "/",
|
44
|
+
f"{config().callback_url_rewrite_prefix}/auth/github/token/callback",
|
45
|
+
)
|
46
|
+
auth_url = self._make_auth_url(
|
47
|
+
auth_req=auth_req, redirect_uri=redirect_uri, state=future_uid
|
42
48
|
)
|
43
|
-
auth_url = self._make_auth_url(auth_req=auth_req, redirect_uri=redirect_uri, state=future_uid)
|
44
49
|
FutureStore.create_future(
|
45
50
|
future_uid,
|
46
51
|
data={
|
@@ -53,7 +58,7 @@ class GitHubTokenAuthHandler(AuthHandlerInterface):
|
|
53
58
|
return f"User needs to authenticate using the following URL: {auth_url}"
|
54
59
|
|
55
60
|
async def authenticate(
|
56
|
-
|
61
|
+
self, auth_req: GitHubTokenRequest, future_uid: str, *args, **kwargs
|
57
62
|
) -> GitHubTokenAuthContext:
|
58
63
|
future_data = FutureStore.get_future(future_uid)
|
59
64
|
access_token = await future_data.future
|
@@ -64,16 +69,17 @@ class GitHubTokenAuthHandler(AuthHandlerInterface):
|
|
64
69
|
return context
|
65
70
|
|
66
71
|
async def refresh(
|
67
|
-
|
72
|
+
self, auth_req: GitHubTokenRequest, context: AuthContext, *args, **kwargs
|
68
73
|
) -> AuthContext:
|
69
74
|
raise Exception("GitHub token doesn't support refresh")
|
70
75
|
|
71
|
-
def _make_auth_url(
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
76
|
+
def _make_auth_url(
|
77
|
+
self, auth_req: GitHubTokenRequest, redirect_uri: str, state: str
|
78
|
+
):
|
79
|
+
params = {"redirect_uri": redirect_uri, "state": state}
|
76
80
|
return f"{self._TOKEN_URL}?{urlencode(params)}"
|
77
81
|
|
78
|
-
def make_request(
|
82
|
+
def make_request(
|
83
|
+
self, auth_scopes: Optional[list[str]] = None, **kwargs
|
84
|
+
) -> GitHubTokenRequest:
|
79
85
|
return GitHubTokenRequest()
|
@@ -5,9 +5,7 @@ class GoogleAuthContext(AuthContext):
|
|
5
5
|
_ACCESS_TOKEN_KEY: str = "GOOGLE_TOKEN"
|
6
6
|
|
7
7
|
def to_dict(self) -> dict[str, str]:
|
8
|
-
return {
|
9
|
-
self._ACCESS_TOKEN_KEY: self.access_token
|
10
|
-
}
|
8
|
+
return {self._ACCESS_TOKEN_KEY: self.access_token}
|
11
9
|
|
12
10
|
def to_profiled_dict(self, profile: str) -> dict[str, str]:
|
13
11
|
return {
|
@@ -12,7 +12,7 @@ class GoogleOAuth2AuthContext(GoogleAuthContext):
|
|
12
12
|
|
13
13
|
@classmethod
|
14
14
|
def from_google_oauth2_response(
|
15
|
-
|
15
|
+
cls, response: GoogleOAuth2Response
|
16
16
|
) -> "GoogleOAuth2AuthContext":
|
17
17
|
description = f"Google OAuth2 Context logged in with {response.scope} scopes"
|
18
18
|
now = datetime.now(tz=timezone.utc)
|
@@ -5,7 +5,10 @@ import httpx
|
|
5
5
|
|
6
6
|
from hyperpocket.auth.context import AuthContext
|
7
7
|
from hyperpocket.auth.google.oauth2_context import GoogleOAuth2AuthContext
|
8
|
-
from hyperpocket.auth.google.oauth2_schema import
|
8
|
+
from hyperpocket.auth.google.oauth2_schema import (
|
9
|
+
GoogleOAuth2Request,
|
10
|
+
GoogleOAuth2Response,
|
11
|
+
)
|
9
12
|
from hyperpocket.auth.handler import AuthHandlerInterface, AuthProvider
|
10
13
|
from hyperpocket.config import config
|
11
14
|
from hyperpocket.futures import FutureStore
|
@@ -32,17 +35,17 @@ class GoogleOAuth2AuthHandler(AuthHandlerInterface):
|
|
32
35
|
return set()
|
33
36
|
|
34
37
|
def prepare(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
self,
|
39
|
+
auth_req: GoogleOAuth2Request,
|
40
|
+
thread_id: str,
|
41
|
+
profile: str,
|
42
|
+
future_uid: str,
|
43
|
+
*args,
|
44
|
+
**kwargs,
|
42
45
|
) -> str:
|
43
46
|
redirect_uri = urljoin(
|
44
|
-
config.public_base_url + "/",
|
45
|
-
f"{config.callback_url_rewrite_prefix}/auth/google/oauth2/callback",
|
47
|
+
config().public_base_url + "/",
|
48
|
+
f"{config().callback_url_rewrite_prefix}/auth/google/oauth2/callback",
|
46
49
|
)
|
47
50
|
auth_url = self._make_auth_url(auth_req, redirect_uri, future_uid)
|
48
51
|
|
@@ -58,9 +61,9 @@ class GoogleOAuth2AuthHandler(AuthHandlerInterface):
|
|
58
61
|
return f"User needs to authenticate using the following URL: {auth_url}"
|
59
62
|
|
60
63
|
async def authenticate(
|
61
|
-
|
64
|
+
self, auth_req: GoogleOAuth2Request, future_uid: str, *args, **kwargs
|
62
65
|
) -> AuthContext:
|
63
|
-
future_data = FutureStore.get_future(
|
66
|
+
future_data = FutureStore.get_future(future_uid)
|
64
67
|
auth_code = await future_data.future
|
65
68
|
|
66
69
|
async with httpx.AsyncClient() as client:
|
@@ -83,7 +86,7 @@ class GoogleOAuth2AuthHandler(AuthHandlerInterface):
|
|
83
86
|
return GoogleOAuth2AuthContext.from_google_oauth2_response(auth_response)
|
84
87
|
|
85
88
|
async def refresh(
|
86
|
-
|
89
|
+
self, auth_req: GoogleOAuth2Request, context: AuthContext, *args, **kwargs
|
87
90
|
) -> AuthContext:
|
88
91
|
google_context: GoogleOAuth2AuthContext = context
|
89
92
|
last_oauth2_resp: GoogleOAuth2Response = google_context.detail
|
@@ -116,7 +119,9 @@ class GoogleOAuth2AuthHandler(AuthHandlerInterface):
|
|
116
119
|
response = GoogleOAuth2Response(**resp_json)
|
117
120
|
return GoogleOAuth2AuthContext.from_google_oauth2_response(response)
|
118
121
|
|
119
|
-
def _make_auth_url(
|
122
|
+
def _make_auth_url(
|
123
|
+
self, auth_req: GoogleOAuth2Request, redirect_uri: str, state: str
|
124
|
+
):
|
120
125
|
params = {
|
121
126
|
"client_id": auth_req.client_id,
|
122
127
|
"redirect_uri": redirect_uri,
|
@@ -128,10 +133,10 @@ class GoogleOAuth2AuthHandler(AuthHandlerInterface):
|
|
128
133
|
return f"{self._GOOGLE_AUTH_URL}?{urlencode(params)}"
|
129
134
|
|
130
135
|
def make_request(
|
131
|
-
|
136
|
+
self, auth_scopes: Optional[list[str]] = None, **kwargs
|
132
137
|
) -> GoogleOAuth2Request:
|
133
138
|
return GoogleOAuth2Request(
|
134
139
|
auth_scopes=auth_scopes,
|
135
|
-
client_id=config.auth.google.client_id,
|
136
|
-
client_secret=config.auth.google.client_secret,
|
140
|
+
client_id=config().auth.google.client_id,
|
141
|
+
client_secret=config().auth.google.client_secret,
|
137
142
|
)
|
@@ -3,13 +3,10 @@ from hyperpocket.auth.gumloop.token_schema import GumloopTokenResponse
|
|
3
3
|
|
4
4
|
|
5
5
|
class GumLoopTokenContext(GumLoopContext):
|
6
|
-
|
7
6
|
@classmethod
|
8
7
|
def from_gumloop_token_response(cls, response: GumloopTokenResponse):
|
9
8
|
description = "Gumloop Token Context logged in"
|
10
9
|
|
11
10
|
return cls(
|
12
|
-
access_token=response.access_token,
|
13
|
-
description=description,
|
14
|
-
expires_at=None
|
11
|
+
access_token=response.access_token, description=description, expires_at=None
|
15
12
|
)
|
@@ -0,0 +1,94 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from urllib.parse import urlencode, urljoin
|
3
|
+
|
4
|
+
from hyperpocket.auth import AuthContext, AuthHandlerInterface, AuthProvider
|
5
|
+
from hyperpocket.auth.gumloop.token_context import GumLoopTokenContext
|
6
|
+
from hyperpocket.auth.gumloop.token_schema import (
|
7
|
+
GumloopTokenRequest,
|
8
|
+
GumloopTokenResponse,
|
9
|
+
)
|
10
|
+
from hyperpocket.auth.schema import AuthenticateRequest
|
11
|
+
from hyperpocket.config import config
|
12
|
+
from hyperpocket.futures import FutureStore
|
13
|
+
|
14
|
+
|
15
|
+
class GumloopTokenAuthHandler(AuthHandlerInterface):
|
16
|
+
name: str = "gumloop-token"
|
17
|
+
description: str = (
|
18
|
+
"This handler is used to authenticate users using the gumloop token"
|
19
|
+
)
|
20
|
+
scoped: bool = False
|
21
|
+
|
22
|
+
_TOKEN_URL = urljoin(
|
23
|
+
config().public_base_url + "/",
|
24
|
+
f"{config().callback_url_rewrite_prefix}/auth/token",
|
25
|
+
)
|
26
|
+
|
27
|
+
@staticmethod
|
28
|
+
def provider() -> AuthProvider:
|
29
|
+
return AuthProvider.GUMLOOP
|
30
|
+
|
31
|
+
@staticmethod
|
32
|
+
def provider_default() -> bool:
|
33
|
+
return True
|
34
|
+
|
35
|
+
@staticmethod
|
36
|
+
def recommended_scopes() -> set[str]:
|
37
|
+
return set()
|
38
|
+
|
39
|
+
def make_request(
|
40
|
+
self, auth_scopes: Optional[list[str]] = None, **kwargs
|
41
|
+
) -> AuthenticateRequest:
|
42
|
+
return GumloopTokenRequest()
|
43
|
+
|
44
|
+
def prepare(
|
45
|
+
self,
|
46
|
+
auth_req: AuthenticateRequest,
|
47
|
+
thread_id: str,
|
48
|
+
profile: str,
|
49
|
+
future_uid: str,
|
50
|
+
*args,
|
51
|
+
**kwargs,
|
52
|
+
) -> str:
|
53
|
+
redirect_uri = urljoin(
|
54
|
+
config().public_base_url + "/",
|
55
|
+
f"{config().callback_url_rewrite_prefix}/auth/gumloop/token/callback",
|
56
|
+
)
|
57
|
+
auth_url = self._make_auth_url(
|
58
|
+
auth_req=auth_req, redirect_uri=redirect_uri, state=future_uid
|
59
|
+
)
|
60
|
+
FutureStore.create_future(
|
61
|
+
future_uid,
|
62
|
+
data={
|
63
|
+
"redirect_uri": redirect_uri,
|
64
|
+
"thread_id": thread_id,
|
65
|
+
"profile": profile,
|
66
|
+
},
|
67
|
+
)
|
68
|
+
|
69
|
+
return f"User needs to authenticate using the following URL: {auth_url}"
|
70
|
+
|
71
|
+
async def authenticate(
|
72
|
+
self, auth_req: AuthenticateRequest, future_uid: str, *args, **kwargs
|
73
|
+
) -> AuthContext:
|
74
|
+
future_data = FutureStore.get_future(future_uid)
|
75
|
+
access_token = await future_data.future
|
76
|
+
|
77
|
+
response = GumloopTokenResponse(access_token=access_token)
|
78
|
+
context = GumLoopTokenContext.from_gumloop_token_response(response)
|
79
|
+
|
80
|
+
return context
|
81
|
+
|
82
|
+
async def refresh(
|
83
|
+
self, auth_req: AuthenticateRequest, context: AuthContext, *args, **kwargs
|
84
|
+
) -> AuthContext:
|
85
|
+
raise Exception("gumloop token doesn't support refresh")
|
86
|
+
|
87
|
+
def _make_auth_url(
|
88
|
+
self, auth_req: AuthenticateRequest, redirect_uri: str, state: str
|
89
|
+
):
|
90
|
+
params = {
|
91
|
+
"redirect_uri": redirect_uri,
|
92
|
+
"state": state,
|
93
|
+
}
|
94
|
+
return f"{self._TOKEN_URL}?{urlencode(params)}"
|