Programmatically generate access tokens for users

Jump to solution
mhaidar
Community Novice

I am developing a single page app which will display the calendar information of each student.
I prefer that the student does not need to login to Canvas first (go through the OAuth2 flow).

I am able to proxy the Canvas API request through a secure server which contains the developer key client id and secret.
Due to API Rate Limiting, I would like to generate an access token for the specific user the request is for.
In the following document, it mentions something about programmatically generating the token

https://community.canvaslms.com/docs/DOC-8381-api-rate-limiting 

However I could not find how to do it in the OAuth2 API documentation

OAuth2 Endpoints - Canvas LMS REST API Documentation 

I understand the client_credentials flow is usually for machine to machine. Is there a way to use this for API (non LTI) requests and be limited to a specific user?

Labels (1)
0 Likes
1 Solution
robotcars
Community Champion

Hi,

You cannot generate tokens for users. Your application needs to use OAuth2.

From the docs, OAuth2 - Canvas LMS REST API Documentation

Note that asking any other user to manually generate a token and enter it into your application is a violation of Canvas' terms of service. Applications in use by multiple users MUST use OAuth to obtain tokens.

View solution in original post

0 Likes