-
Notifications
You must be signed in to change notification settings - Fork 27
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
Draft: Implement support for external oauth #46
base: main
Are you sure you want to change the base?
Conversation
Hey, very cool, @wseaton ! |
schema: args.schema, | ||
username: args.username, | ||
role: args.role, | ||
auth_type: snowflake_api::AuthType::Password(PasswordArgs { |
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.
Instead of having two different internal AuthType
enums with slightly different purposes, what if SnowflakeApi
was just generic over an AuthType
trait, that implements functions for building the login flow? I think that would clean the code up a lot.
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.
SnowflakeApi<OAuth>
where OAuth
impl AuthType
, etc.
} | ||
AuthType::OAuth(token) => { | ||
log::info!("Starting session with oauth authentication"); | ||
self.create(self.oauth_request_body(token)).await |
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.
Here's where we'd want to use generics on the AuthType trait and implement get_request_body
for each auth type.
This is very cool! Something we were looking into ourselves. |
WIP for #36
Took the liberty of refactoring some of the internal session functions along the way, opening this to discuss how that is best done mostly. Current refactoring is going to potentially result in some API breakage.
External Oauth is tested to work on my account.