User not authorized to perform that action

Jump to solution
andersov
Community Explorer

I am getting an unauthorized error when attempting to view user page views while using a token generated from my admin account.

The error is: "user not authorized to perform that action"

The following API call produces the error:

curl https://<institution>.instructure.com/api/v1/users/:userid/page_views \

-X GET \

-H 'Authorization: Bearer :admin_token'

However, a call to "self" works:

curl https://<institution>.instructure.com/api/v1/users/self/page_views \

-X GET \

-H 'Authorization: Bearer :admin_token'

What are the permissions needed to view other users' page views?

Labels (2)
2 Solutions
andersov
Community Explorer
Author

I solved it. Was using our SIS ID for the user, instead of Canvas' 7-digit ID value. Rookie mistake.

View solution in original post

James
Community Champion

Glad you figured it out and ignore my response. Your answer wasn't there when I started typing it.

View solution in original post