Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork21
User and password authentication#2
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
Hello! 😄
Great feature!! ❤️
After checking the code I want to suggest some changes that in my opinion helps the project to stay clean avoiding implicit actions in the initialization of NocoDBClient. 🌟
raise ValueError("Either сredentials or token must be provided") | ||
if not auth_token and (email and password): | ||
auth_token = JWTAuthToken(self.get_auth_token(email, password)) |
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.
I'm not sure about having a HTTP request in theNocoDBRequestsClient
initialization. I suggest creating a class with the purpose of retrieving the AuthToken.
classDiagramclass NocoDBAuthClient { << interface >> +get_auth_token() AuthToken}class NocoDBAuthRequestsClient { +get_auth_token() AuthToken}NocoDBAuthClient <|-- NocoDBAuthRequestsClient
Usage example:
auth_client=NocoDBAuthRequestsClient("username","password")auth_token=auth_client.get_auth_token()client=NocoDBRequestsClient(base_uri,auth_token)
self.__session.headers.update( | ||
auth_token.get_header(), | ||
) | ||
auth_token.get_header(), |
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 change has nothing to do with the commit.
auth_token.get_header(), | |
auth_token.get_header(), |
No description provided.