Chromium Code Reviews| 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..2605b4ac8407f7617a0b17f8e1b4661237615f87 100644 |
| --- a/common/auth/localauth/rpcs/getoauthtoken.go |
| +++ b/common/auth/localauth/rpcs/getoauthtoken.go |
| @@ -10,18 +10,23 @@ import ( |
| // 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 fmt.Errorf(`field "scopes" is required`) |
|
iannucci
2017/06/19 20:31:28
may want to use errors.New so we get a stacktrace
Vadim Sh.
2017/06/19 20:41:36
Done, though I don't really see a point in doing t
|
| case len(r.Secret) == 0: |
| - return fmt.Errorf(`Field "secret" is required.`) |
| + return fmt.Errorf(`field "secret" is required`) |
| } |
| + // TODO(vadimsh): Uncomment when all old auth server are turned off. |
| + //case r.AccountID == "": |
| + // return fmt.Errorf(`field "account_id" is required`) |
| + //} |
| return nil |
| } |