From 20bba4deeb7f3aeb517891cca8572089dc48631d Mon Sep 17 00:00:00 2001 From: aeneasr Date: Fri, 2 Nov 2018 16:51:51 +0100 Subject: [PATCH] cmd: Improve token user error handling Closes #1143 Signed-off-by: aeneasr --- cmd/token_user.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/token_user.go b/cmd/token_user.go index 65d1dc67e65..a0a306e8c70 100644 --- a/cmd/token_user.go +++ b/cmd/token_user.go @@ -135,8 +135,11 @@ var tokenUserCmd = &cobra.Command{ r.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { w.Write([]byte(fmt.Sprintf(` -

Welcome to the example OAuth 2.0 Consumer

-

This example requests an OAuth 2.0 Access, Refresh, and OpenID Connect ID Token from the OAuth 2.0 Server (ORY Hydra). To initiate the flow, click the "Authorize Application" button.

+

Welcome to the exemplary OAuth 2.0 Consumer!

+

This is an example app which emulates an OAuth 2.0 consumer application. Usually, this would be your web or mobile +application and would use an OAuth 2.0 or OpenID Connect library.

+

This example requests an OAuth 2.0 Access, Refresh, and OpenID Connect ID Token from the OAuth 2.0 Server (ORY Hydra). +To initiate the flow, click the "Authorize Application" button.

Authorize application

`, authCodeURL))) @@ -147,7 +150,7 @@ var tokenUserCmd = &cobra.Command{ fmt.Printf("Got error: %s\n", r.URL.Query().Get("error_description")) w.WriteHeader(http.StatusInternalServerError) - fmt.Fprintf(w, "

An error occurred

%s

%s

%s

", r.URL.Query().Get("error"), r.URL.Query().Get("error_description"), r.URL.Query().Get("error_debug")) + fmt.Fprintf(w, "

An error occurred

%s

%s

%s

%s

", r.URL.Query().Get("error"), r.URL.Query().Get("error_description"), r.URL.Query().Get("error_hint"), r.URL.Query().Get("error_debug")) go shutdown() return }