mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-02-02 14:53:55 +08:00
28 lines
689 B
Go
28 lines
689 B
Go
package oauth
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/chaitin/MonkeyCode/backend/consts"
|
|
"github.com/chaitin/MonkeyCode/backend/domain"
|
|
)
|
|
|
|
func NewOAuther(config domain.OAuthConfig) (domain.OAuther, error) {
|
|
switch config.Platform {
|
|
case consts.UserPlatformDingTalk:
|
|
return NewDingTalk(config), nil
|
|
case consts.UserPlatformCustom:
|
|
return NewCustomOAuth(config), nil
|
|
default:
|
|
return nil, fmt.Errorf("unsupported platform: %s", config.Platform)
|
|
}
|
|
}
|
|
|
|
type AccessTokenResponse struct {
|
|
AccessToken string `json:"access_token"`
|
|
ExpiresIn int `json:"expires_in"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
Scope string `json:"scope"`
|
|
UnionID string `json:"unionid"`
|
|
}
|