diff options
| author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-09-19 20:13:08 +0800 |
|---|---|---|
| committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-09-19 20:13:08 +0800 |
| commit | e594d063888db9f36a4682bc31348cea952eadaa (patch) | |
| tree | b899fa56ce1f2a05b0cafb59b868e5fc406d7e39 /token.h | |
| parent | 69ff68be8fa52ac741146789f7be024ada28a4ad (diff) | |
First attempt to validate session token
Function & variable names are changed for consistency & conventions.
Tries to print out shop name from referer header, and the session token
details.
Diffstat (limited to 'token.h')
| -rw-r--r-- | token.h | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/token.h b/token.h deleted file mode 100644 index 40f600e..0000000 --- a/token.h +++ /dev/null @@ -1,26 +0,0 @@ -#include <json.h> - -static inline void token_parse(const char *tok, struct shopify_session *session) -{ - json_tokener *tokener = json_tokener_new(); - json_object *obj = json_tokener_parse_ex(tokener, tok, strlen(tok)); - struct json_object_iterator iter = json_object_iter_begin(obj); - struct json_object_iterator iter_end = json_object_iter_end(obj); - while (!json_object_iter_equal(&iter, &iter_end)) { - if (!strcmp(json_object_iter_peek_name(&iter), - "access_token")) { - const char *val = json_object_get_string( - json_object_iter_peek_value(&iter)); - session->token = malloc(strlen(val) + 1); - strcpy(session->token, val); - } else if (!strcmp(json_object_iter_peek_name(&iter), - "scope")) { - const char *val = json_object_get_string( - json_object_iter_peek_value(&iter)); - session->scope = malloc(strlen(val) + 1); - strcpy(session->scope, val); - } - json_object_iter_next(&iter); - } - json_tokener_free(tokener); -} |