add user scripting with lua
This commit is contained in:
@@ -177,7 +177,7 @@ func (s *OAuthStore) CallbackHandler() http.Handler {
|
||||
http.Error(w, "Failed to exchange token", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
userID, err := getUserInfo(s.config.OAuthProvider.Kind, tok.AccessToken)
|
||||
userID, err := getUserInfo(s.config.OAuthProvider.Kind, tok.AccessToken, s.config)
|
||||
if err != nil {
|
||||
http.Error(w, "Failed to get info", http.StatusInternalServerError)
|
||||
return
|
||||
@@ -210,7 +210,7 @@ func (s *OAuthStore) CallbackHandler() http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
func getUserInfo(providerKind, token string) (string, error) {
|
||||
func getUserInfo(providerKind, token string, c *Config) (string, error) {
|
||||
switch providerKind {
|
||||
case "google":
|
||||
type UserInfo struct {
|
||||
@@ -249,6 +249,6 @@ func getUserInfo(providerKind, token string) (string, error) {
|
||||
}
|
||||
return userInfo.Login, nil
|
||||
default:
|
||||
panic("unimplemented")
|
||||
return RunScript(c.OAuthProvider.Script, token)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user