| Index: common/auth/localauth/rpcs/getoauthtoken.go
|
| diff --git a/common/auth/localauth/rpcs/getoauthtoken.go b/common/auth/localauth/rpcs/getoauthtoken.go
|
| index 7ba42d28cbc8af032e41bc538da5a45a5a7d4860..16ccb661636f1f1d9d2954649b26e7afcee48a33 100644
|
| --- a/common/auth/localauth/rpcs/getoauthtoken.go
|
| +++ b/common/auth/localauth/rpcs/getoauthtoken.go
|
| @@ -5,23 +5,28 @@
|
| package rpcs
|
|
|
| import (
|
| - "fmt"
|
| + "github.com/luci/luci-go/common/errors"
|
| )
|
|
|
| // GetOAuthTokenRequest is parameters for GetOAuthToken RPC call.
|
| type GetOAuthTokenRequest struct {
|
| - Scopes []string `json:"scopes"`
|
| - Secret []byte `json:"secret"`
|
| + Scopes []string `json:"scopes"`
|
| + Secret []byte `json:"secret"`
|
| + AccountID string `json:"account_id"`
|
| }
|
|
|
| -// Validate checks that scopes and secret are set.
|
| +// Validate checks that the request is structurally valid.
|
| func (r *GetOAuthTokenRequest) Validate() error {
|
| switch {
|
| case len(r.Scopes) == 0:
|
| - return fmt.Errorf(`Field "scopes" is required.`)
|
| + return errors.New(`field "scopes" is required`)
|
| case len(r.Secret) == 0:
|
| - return fmt.Errorf(`Field "secret" is required.`)
|
| + return errors.New(`field "secret" is required`)
|
| }
|
| + // TODO(vadimsh): Uncomment when all old auth server are turned off.
|
| + //case r.AccountID == "":
|
| + // return errors.New(`field "account_id" is required`)
|
| + //}
|
| return nil
|
| }
|
|
|
|
|