#include "auth.h" #include "http.h" /* documenting the studysapuri auth protocol paths without domains before are assumed to start with "learn.studysapuri.jp" and also cookies don't seem to be needed POST /qlearn/v2/authorizations body: json object with client_id, client_secret, consent_trail_preset_code, remember_me, and response_type. TO SEND: you need an Authorization header with "Basic [token]" response: json object with access_token amongst other things GET /qlearn/v1/bootstrap headers: Authorization with "Token [access_token from response from earlier]" response: PII, don't keep unless needed after this you can get courses (/qlearn/v1/course_sets), load videos (with video_token grabbed from courses), etc. */ void auth_bootstrap(AuthKey key) { char* key_header = malloc(256); snprintf(key_header, 256, "Authorization: Token %s", key.access_token); char* header_array[] = { key_header, NULL }; struct curl_slist* headers = http_header_maker(header_array); Response r = http_call("https://learn.studysapuri.jp/qlearn/v1/bootstrap", GET, NULL, headers); printf("[auth.bootstrap] r.response = %s\n", r.response); free(key_header); free(headers); free(r.response); }