summaryrefslogtreecommitdiff
path: root/imap
diff options
context:
space:
mode:
Diffstat (limited to 'imap')
-rw-r--r--imap/src/c-client/oauth2_aux.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/imap/src/c-client/oauth2_aux.c b/imap/src/c-client/oauth2_aux.c
index 0ecd0730..550f3b56 100644
--- a/imap/src/c-client/oauth2_aux.c
+++ b/imap/src/c-client/oauth2_aux.c
@@ -235,9 +235,16 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method,
oauth2->cancel_refresh_token = 0; /* do not cancel this token. It is good */
break;
- default : { char tmp[100];
- sprintf(tmp, "Oauth2 client Received Code %d", status);
+ default : { char tmp[200];
+ char *err, *err_desc;
+ jx = json_body_value(json, "error");
+ err = cpystr(jx && jx->jtype == JString ? (char *) jx->value : "Unknown error");
+ jx = json_body_value(json, "error_description");
+ err_desc = cpystr(jx && jx->jtype == JString ? (char *) jx->value : "No description");
+ sprintf(tmp, "Code %d: %.80s: %.80s", status, err, err_desc);
mm_log (tmp, ERROR);
+ if(err) fs_give((void **) &err);
+ if(err_desc) fs_give((void **) &err_desc);
oauth2->cancel_refresh_token++;
}
break;
@@ -302,9 +309,16 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method,
case HTTP_BAD : break;
- default : { char tmp[100];
- sprintf(tmp, "Oauth2 Client Received Code %d", status);
+ default : { char tmp[200];
+ char *err, *err_desc;
+ jx = json_body_value(json, "error");
+ err = cpystr(jx && jx->jtype == JString ? (char *) jx->value : "Unknown error");
+ jx = json_body_value(json, "error_description");
+ err_desc = cpystr(jx && jx->jtype == JString ? (char *) jx->value : "No description");
+ sprintf(tmp, "Code %d: %.80s: %.80s", status, err, err_desc);
mm_log (tmp, ERROR);
+ if(err) fs_give((void **) &err);
+ if(err_desc) fs_give((void **) &err_desc);
oauth2->cancel_refresh_token++;
}
}