Skip to content

Commit c6de29a

Browse files
committed
clearer error if endpoint missing DeviceAuthURL
1 parent e3fb0fb commit c6de29a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

deviceauth.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
7474
// DeviceAuth returns a device auth struct which contains a device code
7575
// and authorization information provided for users to enter on another device.
7676
func (c *Config) DeviceAuth(ctx context.Context, opts ...AuthCodeOption) (*DeviceAuthResponse, error) {
77+
if c.Endpoint.DeviceAuthURL == "" {
78+
return nil, fmt.Errorf("endpoint missing DeviceAuthURL")
79+
}
80+
7781
// https://datatracker.ietf.org/doc/html/rfc8628#section-3.1
7882
v := url.Values{
7983
"client_id": {c.ClientID},

0 commit comments

Comments
 (0)