fix: infoflow's parameter error (#480)

* fix: missing state parameter

Signed-off-by: Steve0x2a <stevesough@gmail.com>

* fix: infoflow's parameter error

Signed-off-by: Steve0x2a <stevesough@gmail.com>

* fix: use userid instead of imid

Signed-off-by: Steve0x2a <stevesough@gmail.com>
This commit is contained in:
Steve0x2a 2022-02-07 21:50:51 +08:00 committed by GitHub
parent 5640d258bb
commit 63161d6135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -130,8 +130,10 @@ type InfoflowInternalUserResp struct {
type InfoflowInternalUserInfo struct { type InfoflowInternalUserInfo struct {
Errcode int `json:"errcode"` Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"` Errmsg string `json:"errmsg"`
Imid string `json:"imid"` UserId string `json:"userid"`
Imid int `json:"imid"`
Name string `json:"name"` Name string `json:"name"`
Avatar string `json:"headimg"`
Email string `json:"email"` Email string `json:"email"`
} }
@ -176,9 +178,10 @@ func (idp *InfoflowInternalIdProvider) GetUserInfo(token *oauth2.Token) (*UserIn
return nil, fmt.Errorf("userInfoResp.errcode = %d, userInfoResp.errmsg = %s", infoResp.Errcode, infoResp.Errmsg) return nil, fmt.Errorf("userInfoResp.errcode = %d, userInfoResp.errmsg = %s", infoResp.Errcode, infoResp.Errmsg)
} }
userInfo := UserInfo{ userInfo := UserInfo{
Id: infoResp.Imid, Id: infoResp.UserId,
Username: infoResp.Name, Username: infoResp.UserId,
DisplayName: infoResp.Name, DisplayName: infoResp.Name,
AvatarUrl: infoResp.Avatar,
Email: infoResp.Email, Email: infoResp.Email,
} }

View File

@ -70,7 +70,7 @@ func GetIdProvider(typ string, subType string, clientId string, clientSecret str
return NewBaiduIdProvider(clientId, clientSecret, redirectUrl) return NewBaiduIdProvider(clientId, clientSecret, redirectUrl)
} else if typ == "Infoflow" { } else if typ == "Infoflow" {
if subType == "Internal" { if subType == "Internal" {
return NewInfoflowInternalIdProvider(clientId, clientId, appId, redirectUrl) return NewInfoflowInternalIdProvider(clientId, clientSecret, appId, redirectUrl)
} else if subType == "Third-party" { } else if subType == "Third-party" {
return NewInfoflowIdProvider(clientId, clientSecret, appId, redirectUrl) return NewInfoflowIdProvider(clientId, clientSecret, appId, redirectUrl)
} else { } else {