Fix errcheck issue in oauth.go (#28795)

This commit is contained in:
TheInvincible 2024-11-04 09:07:04 +01:00 committed by GitHub
parent f2182d806b
commit be7a8a17c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

View file

@ -246,7 +246,6 @@ issues:
channels/store/storetest/user_store.go|\
channels/testlib/helper.go|\
channels/utils/license_test.go|\
channels/web/oauth.go|\
channels/web/oauth_test.go|\
channels/web/saml.go|\
channels/web/static.go|\

View file

@ -78,7 +78,10 @@ func authorizeOAuthApp(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.Success()
c.LogAudit("success")
w.Write([]byte(model.MapToJSON(map[string]string{"redirect": redirectURL})))
_, err = w.Write([]byte(model.MapToJSON(map[string]string{"redirect": redirectURL})))
if err != nil {
c.Logger.Error("Error writing response", mlog.Err(err))
}
}
func deauthorizeOAuthApp(c *Context, w http.ResponseWriter, r *http.Request) {
@ -201,7 +204,10 @@ func authorizeOAuthPage(c *Context, w http.ResponseWriter, r *http.Request) {
}
func getAccessToken(c *Context, w http.ResponseWriter, r *http.Request) {
r.ParseForm()
if err := r.ParseForm(); err != nil {
c.Err = model.NewAppError("getAccessToken", "api.oauth.get_access_token.bad_request.app_error", nil, "", http.StatusBadRequest)
return
}
code := r.FormValue("code")
refreshToken := r.FormValue("refresh_token")

View file

@ -2360,6 +2360,10 @@
"id": "api.oauth.get_access_token.bad_grant.app_error",
"translation": "invalid_request: Bad grant_type."
},
{
"id": "api.oauth.get_access_token.bad_request.app_error",
"translation": "invalid_request: Bad request."
},
{
"id": "api.oauth.get_access_token.credentials.app_error",
"translation": "invalid_client: Invalid client credentials."