cancel
Showing results for 
Search instead for 
Did you mean: 
andersov
Community Member

User not authorized to perform that action

Jump to solution

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)
1 Solution

Accepted Solutions
andersov
Community Member

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

6 Replies
robotcars
Navigator

Good question.

What is your current role?

I have admin and root_admin and can hit that endpoint without masquerading. I'm having a hard time seeing what permissions Account Admin role has that give me permission on the API.

My role is as an account admin

andersov
Community Member

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
Navigator

andersov,

My guess (after ruling out what carroll-ccsd  suggested) is to double check the user ID and make sure it's the correct type and a valid number.

You need to be entering the Canvas user ID and not your SIS user ID (unless you preface it with sis_user_id: as explained on the SIS IDs page.

Also make sure that the users is yours and you didn't transpose some digits. For example, user 8296700 is ours, but if I put 8269700, I get a 401 Unauthorized error because that user belongs to a different account.

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

andersov
Community Member

Thanks for the on-the-money answer. Sorry I didn't figure it out sooner and save you the trouble Smiley Wink