| 1 |
syntax = "proto3"; |
| 2 |
|
| 3 |
package svc.auth.v1; |
| 4 |
|
| 5 |
import "google/protobuf/duration.proto"; |
| 6 |
import "google/protobuf/timestamp.proto"; |
| 7 |
import "types/v1/environment.proto"; |
| 8 |
import "types/v1/meta.proto"; |
| 9 |
import "types/v1/user_token.proto"; |
| 10 |
import "types/v1/version.proto"; |
| 11 |
|
| 12 |
option go_package = "svc/auth/v1;authv1"; |
| 13 |
|
| 14 |
service AuthService { |
| 15 |
rpc GetAuthURL(GetAuthURLRequest) returns (GetAuthURLResponse) {} |
| 16 |
rpc BeginDeviceAuth(BeginDeviceAuthRequest) returns (BeginDeviceAuthResponse) {} |
| 17 |
rpc CompleteDeviceAuth(CompleteDeviceAuthRequest) returns (CompleteDeviceAuthResponse) {} |
| 18 |
} |
| 19 |
|
| 20 |
message GetAuthURLRequest { |
| 21 |
// optional: if an org is specified |
| 22 |
oneof organization { |
| 23 |
int64 by_id = 100; |
| 24 |
string by_name = 101; |
| 25 |
} |
| 26 |
string return_to_url = 2; |
| 27 |
LocalhostViaBrowser localhost = 3; |
| 28 |
} |
| 29 |
|
| 30 |
message LocalhostViaBrowser { |
| 31 |
string architecture = 1; |
| 32 |
string operating_system = 2; |
| 33 |
types.v1.Version using_version = 3; |
| 34 |
} |
| 35 |
|
| 36 |
message GetAuthURLResponse { |
| 37 |
string auth_url = 1; |
| 38 |
} |
| 39 |
|
| 40 |
message BeginDeviceAuthRequest { |
| 41 |
string organization = 1; |
| 42 |
string return_to_url = 2; |
| 43 |
} |
| 44 |
|
| 45 |
message BeginDeviceAuthResponse { |
| 46 |
string url = 1; |
| 47 |
// device_code must be used to retrieve an authenticated user token with `CompleteDeviceAuth` |
| 48 |
string device_code = 2; |
| 49 |
string user_code = 3; |
| 50 |
google.protobuf.Timestamp expires_at = 4; |
| 51 |
google.protobuf.Duration poll_interval = 5; |
| 52 |
} |
| 53 |
|
| 54 |
message CompleteDeviceAuthRequest { |
| 55 |
// device_code is returned when calling `BeginDeviceAuth` and allows an auth flow |
| 56 |
// to retrieve the user token that is generated when a user is authenticated |
| 57 |
string device_code = 1; |
| 58 |
string user_code = 2; |
| 59 |
string architecture = 5; |
| 60 |
string operating_system = 6; |
| 61 |
} |
| 62 |
|
| 63 |
message CompleteDeviceAuthResponse { |
| 64 |
types.v1.UserToken token = 1; |
| 65 |
} |