Until Olive I’d been using the following simple procedure for viewing mobile api endpoints on the command line:
BASE_DOMAIN="EXAMPLE.COM"
USER="SET-ME-PLEASE"
PASSWORD="SET-ME-PLEASE"
CLIENT_ID="SET-ME-PLEASE"
CLIENT_SECRET="SET-ME-PLEASE"
# authentication gymnastics
# ------------------------------------------------------
AUTH_URL="https://${BASE_DOMAIN}/oauth2/access_token"
GRANT_TYPE="password"
ACCESS_TOKEN=$(curl -X POST -d "grant_type=${GRANT_TYPE}&username=${USER}&password=${PASSWORD}" -u"${CLIENT_ID}:${CLIENT_SECRET}" $AUTH_URL | jq .access_token)
TOKEN="${ACCESS_TOKEN}:access_token"
# some mobile api url endpoints that should work, but don't:
# -------------
curl -L -H "Authorization: Bearer ${TOKEN}" https://${BASE_DOMAIN}/api/mobile/v1/users/${USER}
curl -L -H "Authorization: Bearer ${TOKEN}" https://${BASE_DOMAIN}${REQUEST_PATH}/course_enrollments
curl -L -H "Authorization: Bearer ${TOKEN}" https://${BASE_DOMAIN}${REQUEST_PATH}/course_status_info
This seems to have stopped working in Olive, as I get the following edx-platform generated response on all endpoints that I’ve attempted:
{"error_code":"token_nonexistent","developer_message":"The provided access token does not match any valid tokens."}
I’ve verified that the access_token returned by the oauth authentication workflow is in fact persisted in the Django Oauth Toolkit AccessTokens model and that it is associated with the username that I’m using.
Any idea why I would be getting this response?