33 lines
746 B
Go
33 lines
746 B
Go
package auth
|
|
|
|
import (
|
|
"context"
|
|
|
|
"apps/backend/internal/svc"
|
|
"apps/backend/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type OAuthStartLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewOAuthStartLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OAuthStartLogic {
|
|
return &OAuthStartLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *OAuthStartLogic) OAuthStart(req *types.AuthOAuthProviderPath) (resp *types.AuthOAuthStartData, err error) {
|
|
p := req.Provider
|
|
if p == "" {
|
|
p = "google"
|
|
}
|
|
return &types.AuthOAuthStartData{
|
|
AuthorizeUrl: "https://example.com/oauth/" + p + "/authorize?state=dev",
|
|
Provider: p,
|
|
State: "dev",
|
|
}, nil
|
|
}
|