Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Conversation

@J0
Copy link
Contributor

@J0 J0 commented Oct 29, 2023

What kind of change does this PR introduce?

Address #340

  • Change implementation to return URL directly
  • Add docstrings

Tested using flask-notes. Do note that we don't follow redirects on this method to mirror JS + also because httpx doesn't allow following of redirects

@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

Attention: 22 lines in your changes are missing coverage. Please review.

Comparison is base (160b671) 45.68% compared to head (9fbe011) 45.44%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #358      +/-   ##
==========================================
- Coverage   45.68%   45.44%   -0.24%     
==========================================
  Files          23       23              
  Lines        1902     1934      +32     
==========================================
+ Hits          869      879      +10     
- Misses       1033     1055      +22     
Files Coverage Δ
gotrue/_sync/gotrue_base_api.py 93.18% <100.00%> (+0.15%) ⬆️
gotrue/types.py 99.05% <100.00%> (+0.02%) ⬆️
gotrue/_async/gotrue_client.py 29.72% <8.33%> (-0.66%) ⬇️
gotrue/_sync/gotrue_client.py 29.72% <8.33%> (-0.66%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@J0 J0 marked this pull request as ready for review January 17, 2024 06:20
@J0
Copy link
Contributor Author

J0 commented Jan 17, 2024

Probably should test this end to end once

@J0 J0 marked this pull request as draft January 19, 2024 11:26
@J0 J0 marked this pull request as ready for review January 28, 2024 15:17
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Type: Enhancement

PR Summary: This pull request introduces the functionality for single sign-on (SSO) authentication, allowing users to authenticate using an enterprise Identity Provider. The changes include the implementation of SSO in both asynchronous and synchronous GoTrue client classes, the addition of necessary types and response parsers, and updates to the documentation to reflect the new feature.

Decision: Comment

📝 Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
✅ Small diff: the diff is small enough to approve with confidence.
No details provided.

General suggestions:

  • Review the usage of the 'captcha_token' variable within the 'sign_in_with_sso' methods as it is currently assigned but not utilized. If it is meant for future use, it should be documented accordingly.
  • Ensure that the 'parse_sso_response' function is thoroughly tested to handle the expected SSO response structure and any edge cases that may occur during the SSO process.
  • The 'skip_http_redirect' field should be typed as a boolean to reflect its intended usage, rather than as a string. This change will improve code clarity and prevent potential type-related bugs.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

domain = credentials.get("domain")
options = credentials.get("options", {})
redirect_to = options.get("redirect_to")
captcha_token = options.get("captcha_token")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (llm): The variable 'captcha_token' is assigned but not used within the 'sign_in_with_sso' method. If it's intended for future use or has side effects, consider adding a comment to clarify its purpose.

domain = credentials.get("domain")
options = credentials.get("options", {})
redirect_to = options.get("redirect_to")
captcha_token = options.get("captcha_token")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (llm): As in the async client, the 'captcha_token' is assigned but not used in the synchronous 'sign_in_with_sso' method. If this is intentional, please add a comment to explain its presence.

gotrue/types.py Outdated
class SignInWithSSOOptions(TypedDict):
redirect_to: NotRequired[str]
captcha_token: NotRequired[str]
skip_http_redirect: NotRequired[str]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (llm): The 'skip_http_redirect' field in 'SignInWithSSOOptions' is typed as a string, but its usage suggests a boolean value. Consider correcting the type to 'NotRequired[bool]' for clarity and correctness.

return model_validate(UserResponse, data)


def parse_sso_response(data: Any) -> SSOResponse:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (llm): The 'parse_sso_response' function is added to handle SSO responses. Verify that this function correctly parses the expected data structure and handles any potential edge cases or errors that may arise from the SSO process.

@J0 J0 merged commit c250f93 into main Jan 28, 2024
@J0 J0 deleted the j0/add_sso branch January 28, 2024 15:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants