This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
/
payload.go
42 lines (37 loc) · 1.94 KB
/
payload.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package deviceflow
import "golang.org/x/oauth2"
// DeviceAuthorizationRequest sent to authorization server directly from the client app
type DeviceAuthorizationRequest struct {
// ClientID is the client identifier issued to the client during the registration process of OAuth app with the authorization server
ClientID string `json:"client_id"`
// Scope is the scope parameter of the access request
Scope string `json:"scope"`
}
// DeviceAuthorizationResponse contains the information that the end user would use to authorize the app requesting the
// resource access.
type DeviceAuthorizationResponse struct {
// DeviceCode unique device code generated by the authorization server.
DeviceCode string `json:"device_code"`
// UserCode unique code generated for the user to enter on another device
UserCode string `json:"user_code"`
// VerificationURI url endpoint of the authorization server which host the device and app verification
VerificationURI string `json:"verification_uri"`
// VerificationURIComplete url endpoint of the authorization server which host the device and app verification along with user code
VerificationURIComplete string `json:"verification_uri_complete"`
// ExpiresIn lifetime in seconds of the "device_code" and "user_code"
ExpiresIn int64 `json:"expires_in"`
// Interval minimum amount of time in secs the client app should wait between polling requests to the token endpoint.
Interval int64 `json:"interval"`
}
type DeviceAccessTokenRequest struct {
// ClientID is the client identifier issued to the client during the registration process of OAuth app with the authorization server
ClientID string `json:"client_id"`
// DeviceCode unique device code generated by the authorization server.
DeviceCode string `json:"device_code"`
// Value MUST be set to "urn:ietf:params:oauth:grant-type:device_code"
GrantType string `json:"grant_type"`
}
type DeviceAccessTokenResponse struct {
oauth2.Token
Error string `json:"error"`
}