added logging
This commit is contained in:
+11
-2
@@ -129,11 +129,20 @@ func checkUserAuthorization(userID, accessToken string) (bool, string, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// Read the response body first for logging
|
||||
bodyBytes, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
helper.LogError(err, "Failed to read authorization response body")
|
||||
return false, "", err
|
||||
}
|
||||
|
||||
log.Printf("AUTHZ RAW RESPONSE Status: %d, Body: %s", resp.StatusCode, string(bodyBytes))
|
||||
|
||||
// Parse response
|
||||
var authResp models.AuthorizationResponse
|
||||
|
||||
if err := json.NewDecoder(resp.Body).Decode(&authResp); err != nil {
|
||||
if err := json.Unmarshal(bodyBytes, &authResp); err != nil {
|
||||
helper.LogError(err, "Failed to decode authorization response")
|
||||
log.Printf("Failed to unmarshal response body: %s", string(bodyBytes))
|
||||
return false, "", err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user