commit 756b0c9

default  ·  2023-12-05 04:47:53 +0000 UTC
parent 04e5151
mastoapi: correctly print the auth key in the sepcial urn:ietf... case.
1 files changed,  +8, -2
+8, -2
 1@@ -279,8 +279,14 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
 2                     xs *code = random_str();
 3 
 4                     xs_free(*body);
 5-                    *body = xs_fmt("%s?code=%s", redir, code);
 6-                    status = 303;
 7+
 8+                    if (strcmp(redir, "urn:ietf:wg:oauth:2.0:oob") == 0) {
 9+                        *body = xs_dup(code);
10+                    }
11+                    else {
12+                        *body = xs_fmt("%s?code=%s", redir, code);
13+                        status = 303;
14+                    }
15 
16                     /* if there is a state, add it */
17                     if (!xs_is_null(state) && *state) {