smartsheet-apismartsheet-api-2.0

Assume-user not working in smartsheet api


Hi I am testing SmartSheet Api for my new application. I was trying to use assume user function. I have a System Admin account say admin@xxxx.com and a non-admin account user@xxxx.com. I am getting errorCode 1030

Note : I currently have the trial plan.

I am passing the following header

{'Authorization': 'Bearer {admin's token}',
 'Content-Type': 'application/json',
 'Assume-User': 'user%40xxxx.com'}

I generated this token using OAUTH using the admins account and I requested following scopes

ACCESS_REQUEST = [
    "ADMIN_SHEETS",
    "ADMIN_SIGHTS",
    "ADMIN_USERS",
    "READ_USERS",
    "ADMIN_WEBHOOKS",
    "READ_SHEETS",
    "READ_SIGHTS",
    "ADMIN_WORKSPACES",
    "READ_CONTACTS"
]

I am trying to hit the users/me endpoint. I am getting the following error.

{'errorCode': 1030,
 'message': 'You are unable to assume the user specified.',
 'refId': 'h4tq8b'}

Solution

  • I suspect the error that you're seeing is being caused by the fact that you're using OAuth to generate the API access token for the admin user account. I'm able to reproduce that error if I specify a token that I generated via OAuth, but if I specify a token that I generated manually via the Smartsheet web app (UI), then the Get Current User call is successful.

    I'd suggest that you login to the Smartsheet web app (UI) as the admin user and manually generate an API access token, as described here: Raw Token Requests. Then specify that access token in the Authorization header of the request and the Get Current User call should return a successful response.

    Finally, it's also worth noting that the non-admin user account you're trying to impersonate in this scenario must be a member of the same Smartsheet account as the Admin user account that owns the token specified in the Authorization header.