Skip to content

Commit 9095a51

Browse files
hickfordgopherbot
authored andcommitted
oauth2: clarify error if endpoint missing DeviceAuthURL
Change-Id: I36eb5eb66099161785160f4f39ea1c7f64ad6e74 GitHub-Last-Rev: 31cfe81 GitHub-Pull-Request: #664 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/526302 Reviewed-by: Matthew Dempsky <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent 2d9e4a2 commit 9095a51

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

deviceauth.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package oauth2
33
import (
44
"context"
55
"encoding/json"
6+
"errors"
67
"fmt"
78
"io"
89
"net/http"
@@ -88,6 +89,10 @@ func (c *Config) DeviceAuth(ctx context.Context, opts ...AuthCodeOption) (*Devic
8889
}
8990

9091
func retrieveDeviceAuth(ctx context.Context, c *Config, v url.Values) (*DeviceAuthResponse, error) {
92+
if c.Endpoint.DeviceAuthURL == "" {
93+
return nil, errors.New("endpoint missing DeviceAuthURL")
94+
}
95+
9196
req, err := http.NewRequest("POST", c.Endpoint.DeviceAuthURL, strings.NewReader(v.Encode()))
9297
if err != nil {
9398
return nil, err

0 commit comments

Comments
 (0)