Canvas API 401 Error Using a new Access Token

Jump to solution
Community Explorer

Since creating a new Access Token for the integration, I'm able to upload sis csv import files with the API. However, I am not able to use any of the other API calls (i.e. create logins, list canvas terms, etc...). Seeing how I am an Admin, I am not sure why this is happening. The error is "Invalid access token" when attempting to use calls other than sis csv import calls.

Previous Access Token worked fine. It expired so I created the new one.

Here is an example of using curl with a list terms call and a file upload call:


W20190643:Canvas crierk$ curl -H "Authorization: Bearer <Access Token>" ''

{"errors":[{"message":"Invalid access token."}]}W20190643:Canvas crierk$ 


W20190643:Canvas crierk$ curl -F attachment=@/Users/crierk/Canvas/Terms_20230106-150242.csv -H "Authorization: Bearer <Access Token>" ''

{"id":327587,"created_at":"2023-01-07T07:50:54Z","started_at":null,"ended_at":null,"updated_at":"2023-01-07T07:50:55Z","progress":0,"workflow_state":"created","data":{"import_type":"instructure_csv"},"batch_mode":null,"batch_mode_term_id":null,"multi_term_batch_mode":null,"override_sis_stickiness":null,"add_sis_stickiness":null,"update_sis_id_if_login_claimed":false,"clear_sis_stickiness":null,"diffing_data_set_identifier":null,"diffing_remaster":null,"diffed_against_import_id":null,"diffing_drop_status":null,"skip_deletes":false,"change_threshold":null,"diff_row_count_threshold":null,"user":{"id":532,"name":"Kolis Crier","created_at":"2020-06-09T10:13:43-07:00","sortable_name":"Crier, Kolis","short_name":"Kolis Crier","sis_user_id":"V00326970","integration_id"H "Authorization: Bearer <Access Token>" ''


Labels (3)
1 Solution
Community Explorer

Hi @chriscas 

Thanks for chiming in.

I spent some time with Canvas support and didn't appreciate the deflecting tactics. For instance, telling me that the "purpose" field of the access token is what determines what the token can be used for.

I wound up creating yet another token. That token works consistently.

I suspect that the token I create may have been corrupted behind the scenes since it only "Kind of" worked. Or... Canvas support fixed the issues without saying an issue existed and thus the subsequent token worked. Who knows.

I am good to go now.

Thanks again.


View solution in original post