Skip to content
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

feat: add twitter SSO #3778

Merged
merged 8 commits into from
Mar 1, 2024
Merged

feat: add twitter SSO #3778

merged 8 commits into from
Mar 1, 2024

Conversation

aeneasr
Copy link
Member

@aeneasr aeneasr commented Feb 23, 2024

@aeneasr aeneasr self-assigned this Feb 28, 2024
@aeneasr aeneasr marked this pull request as ready for review February 28, 2024 12:00
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 42.93785% with 101 lines in your changes are missing coverage. Please review.

Project coverage is 78.13%. Comparing base (7f8a7f1) to head (d2d63ff).
Report is 1 commits behind head on master.

Files Patch % Lines
selfservice/strategy/oidc/provider_x.go 0.00% 65 Missing ⚠️
selfservice/strategy/oidc/strategy.go 55.55% 24 Missing and 8 partials ⚠️
selfservice/strategy/oidc/strategy_settings.go 62.50% 1 Missing and 2 partials ⚠️
selfservice/strategy/oidc/provider_dingtalk.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3778      +/-   ##
==========================================
- Coverage   78.37%   78.13%   -0.24%     
==========================================
  Files         348      349       +1     
  Lines       24011    24113     +102     
==========================================
+ Hits        18818    18841      +23     
- Misses       3772     3852      +80     
+ Partials     1421     1420       -1     

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

Copy link
Member

@zepatrik zepatrik left a comment

Choose a reason for hiding this comment

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

Looks good, just some minor questions.

@@ -327,6 +327,7 @@ require (

require (
github.com/coreos/go-oidc/v3 v3.9.0
github.com/dghubble/oauth1 v0.7.2
Copy link
Member

Choose a reason for hiding this comment

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

To implement "Login with X", use the gologin packages which provide login handlers for OAuth1 and OAuth2 providers.

To call the Twitter, Digits, or Tumblr OAuth1 APIs, use the higher level Go API clients.

Did you check that note in the repo's readme?

Copy link
Member

Choose a reason for hiding this comment

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

The usage later looks valid IMO.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this should be fine!

Comment on lines +60 to +61
// We need to cheat so that callback validates on return
c.CallbackURL = c.CallbackURL + fmt.Sprintf("?state=%s&code=unused", state)
Copy link
Member

Choose a reason for hiding this comment

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

What exactly is the cheat referred to here? Do we need to set a code, but it gets ignored by twitter? Will it still be in the URL when being redirected back?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question - I took over some of the code from PR #517 where this originally was at. I believe that OAuth1 doesn't return a code parameter like OAuth2, and that would break the provider logic. So the added this workaround? I'm not sure to be honest.

@aeneasr aeneasr merged commit 930fb19 into master Mar 1, 2024
28 of 29 checks passed
@aeneasr aeneasr deleted the add-twitter branch March 1, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Social sign in with Twitter
2 participants