MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / Login

Method Login

sdk/auth/manager.go:47–76  ·  view source on GitHub ↗

Login executes the provider login flow and persists the resulting auth record.

(ctx context.Context, provider string, cfg *config.Config, opts *LoginOptions)

Source from the content-addressed store, hash-verified

45
46// Login executes the provider login flow and persists the resulting auth record.
47func (m *Manager) Login(ctx context.Context, provider string, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, string, error) {
48 auth, ok := m.authenticators[provider]
49 if !ok {
50 return nil, "", fmt.Errorf("cliproxy auth: authenticator %s not registered", provider)
51 }
52
53 record, err := auth.Login(ctx, cfg, opts)
54 if err != nil {
55 return nil, "", err
56 }
57 if record == nil {
58 return nil, "", fmt.Errorf("cliproxy auth: authenticator %s returned nil record", provider)
59 }
60
61 if m.store == nil {
62 return record, "", nil
63 }
64
65 if cfg != nil {
66 if dirSetter, ok := m.store.(interface{ SetBaseDir(string) }); ok {
67 dirSetter.SetBaseDir(cfg.AuthDir)
68 }
69 }
70
71 savedPath, err := m.store.Save(ctx, record)
72 if err != nil {
73 return record, "", err
74 }
75 return record, savedPath, nil
76}

Callers

nothing calls this directly

Calls 3

LoginMethod · 0.65
SaveMethod · 0.65
SetBaseDirMethod · 0.45

Tested by

no test coverage detected