From 0a614f58f49b5d1fc56a5e0817c1c14bc122c049 Mon Sep 17 00:00:00 2001 From: Dave Dykstra <2129743+DrDaveD@users.noreply.github.com> Date: Fri, 28 Aug 2020 11:59:47 -0500 Subject: [PATCH] add separate message if poll response is not json --- path_oidc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/path_oidc.go b/path_oidc.go index 456e7e1c..36a3b857 100644 --- a/path_oidc.go +++ b/path_oidc.go @@ -462,6 +462,10 @@ func (b *jwtAuthBackend) pathPoll(ctx context.Context, req *logical.Request, d * return nil, errwrap.Wrapf("error polling for device authorization: {{err}}", err) } + if body[0] != '{' { + return nil, fmt.Errorf("issuer response while polling for token is not json: %v", string(body)) + } + var tokenOrError struct { *oauth2.Token Error string `json:"error,omitempty"`