-
Notifications
You must be signed in to change notification settings - Fork 2
Extend client auth methods #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit 77209fb.
|
The publishable_key, client session, and console session auth are only used from a browser context and thus will only be used by the JS SDK. |
| api_key="seam_at1_shorttoken_longtoken", | ||
| endpoint=f"https://{r}.fakeseamconnect.seam.vc", | ||
| personal_access_token="seam_at1_shorttoken_longtoken", | ||
| workspace_id="seed_workspace_1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting: Creating a workspace should not be allowed when using a PAT and a workspace ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fix the endpoint then. What type of auth should be allowed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The auth on that endpoint is PAT without a Workspace. This is correct, since a PAT with a workspace cannot operate or create resources outside of the workspace.
The JS SDK handles this by omitting the method from the Seam class but allowing it for SeamMultiWorkspaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side node, I realize now that the name SeamHttpWorkspaces implies that operations should work for different workspaces, but it really needs to mean the client only provides operations that are "workspace less". Maybe we can think of a better name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. So what approach should we take in Python SDK? Ignore /workspaces/create on Seam client and add SeamMultiWorkspace client that will support that endpoint and allow passing PAT without workspace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 😀
razor-x
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Two main things:
- Let's add the parse_options function, see https://github.com/seamapi/javascript-http/blob/main/src/lib/seam/connect/parse-options.ts#L31-L85
- We should require the workspace_id when using PAT and introduce SeamMultiWorkspace class in another PR.
razor-x
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a few last comments :)
razor-x
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good to include in the generator now. Let's export any other custom errors in the generated code.
Enable authenticating Seam client with PAT. Add
Seam.from_personal_access_tokenandSeam.from_api_keystatic methods.