Skip to content

Commit

Permalink
clearer error if endpoint missing DeviceAuthURL
Browse files Browse the repository at this point in the history
  • Loading branch information
hickford committed Sep 22, 2023
1 parent 2d9e4a2 commit 31cfe81
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions deviceauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package oauth2
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -88,6 +89,10 @@ func (c *Config) DeviceAuth(ctx context.Context, opts ...AuthCodeOption) (*Devic
}

func retrieveDeviceAuth(ctx context.Context, c *Config, v url.Values) (*DeviceAuthResponse, error) {
if c.Endpoint.DeviceAuthURL == "" {
return nil, errors.New("endpoint missing DeviceAuthURL")
}

req, err := http.NewRequest("POST", c.Endpoint.DeviceAuthURL, strings.NewReader(v.Encode()))
if err != nil {
return nil, err
Expand Down

0 comments on commit 31cfe81

Please sign in to comment.