Skip to content

Commit

Permalink
cmd: Improve token user error handling
Browse files Browse the repository at this point in the history
Closes #1143

Signed-off-by: aeneasr <aeneas@ory.sh>
  • Loading branch information
aeneasr committed Nov 2, 2018
1 parent 3a10df9 commit 20bba4d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/token_user.go
Expand Up @@ -135,8 +135,11 @@ var tokenUserCmd = &cobra.Command{
r.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
w.Write([]byte(fmt.Sprintf(`
<html><head></head><body>
<h1>Welcome to the example OAuth 2.0 Consumer</h1>
<p>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.</p>
<h1>Welcome to the exemplary OAuth 2.0 Consumer!</h1>
<p>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 <a href="https://oauth.net/code/">OAuth 2.0</a> or <a href="https://oauth.net/code/">OpenID Connect</a> library.</p>
<p>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.</p>
<p><a href="%s">Authorize application</a></p>
</body>
`, authCodeURL)))
Expand All @@ -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, "<html><body><h1>An error occurred</h1><h2>%s</h2><p>%s</p><p>%s</p></body></html>", r.URL.Query().Get("error"), r.URL.Query().Get("error_description"), r.URL.Query().Get("error_debug"))
fmt.Fprintf(w, "<html><body><h1>An error occurred</h1><h2>%s</h2><p>%s</p><p>%s</p><p>%s</p></body></html>", 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
}
Expand Down

0 comments on commit 20bba4d

Please sign in to comment.