Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
davert0 wants to merge 2 commits into elchicodepython:master
base: master
Choose a base branch
Loading
from epoch8:feat/auth

Conversation

@davert0
Copy link
Contributor

@davert0 davert0 commented Sep 15, 2022

No description provided.

Copy link
Owner

@elchicodepython elchicodepython left a 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))
Copy link
Owner

@elchicodepython elchicodepython Sep 19, 2022

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 the NocoDBRequestsClient initialization. I suggest creating a class with the purpose of retrieving the AuthToken.

classDiagram
class NocoDBAuthClient {
 << interface >>
 +get_auth_token() AuthToken
}
class NocoDBAuthRequestsClient {
 +get_auth_token() AuthToken
}
NocoDBAuthClient <|-- NocoDBAuthRequestsClient
Loading

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(),
Copy link
Owner

@elchicodepython elchicodepython Sep 19, 2022

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.

Suggested change
auth_token.get_header(),
auth_token.get_header(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@elchicodepython elchicodepython elchicodepython requested changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /