instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.43k stars 2.43k forks source link

How to generate access token #2181

Closed tuantiensiu closed 10 months ago

tuantiensiu commented 1 year ago

I want to manually generate access token for user account with admin token, can I do this?

Example step

  1. Send API with admin token, user id client or email client
  2. Response access token client
ccutrer commented 1 year ago

No, it is not possible to generate an access token for a user. You either need to set up a Developer Key, and have each user go through the OAuth flow (https://canvas.instructure.com/doc/api/file.oauth.html), or if you will maintain control of the access token, and just need to make API requests as if you were a particular user, you can use your admin access token and masquerade as a user (https://canvas.instructure.com/doc/api/file.masquerading.html).

tuantiensiu commented 1 year ago

I see admin doesn't have permission to create access token for user with masquerade