-
Notifications
You must be signed in to change notification settings - Fork 209
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
oauth2: user.OAuth2UID not set before calling SaveOAuth2 #333
Comments
Thinking more about this, maybe the usage of Oauth2 module could be simplified (and made more flexible).
type OAuth2Result struct {
Provider string
AccessToken string
Expiry time.Time
RefreshToken string
}
type OAuth2ServerStorer interface {
FindOrCreateOAuth2User(ctx context.Context, result OAuth2Result, details map[string]string) (User, error)
}
This would be a fairly large (breaking) change, but it would make it easier to implement oauth2 support. I guess there are still other steps needed to allow the usage of multiple OAuth2 providers to log the same user (I think this is currently not possible). |
related: #294 |
The reason was to give the developer control over the OAuth2ID. Because we don't understand their provider or how their storage system might work we didn't want to enforce specifics. This is called out here:
The initial idea behind Authboss's oauth2 was actually not to separate the identity of oauth users, but be able to (if desired) combine them with the existing user/password style. Hence this extra flexibility and lack of prescription. |
Experimented in #332 |
Is there any reason why
user.OAuth2UID
is not set before callingSaveOAuth2
? (just likeprovider
,accessToken
,Expiry
andRefreshToken
)authboss/oauth2/oauth2.go
Lines 235 to 247 in e62387f
This can be handled by the developer in
NewFromOAuth2
, but it feels kind of odd.The text was updated successfully, but these errors were encountered: