AnsweredAssumed Answered

Create user with the API

Question asked by Jose Perez on Nov 5, 2018
Latest reply on Nov 7, 2018 by Jose Perez


I'm trying to create users with the API with a form in my website, so any possible student can create his own account and join my courses directly.

The API request works correctly with Postman, it returns the data and when I check the users they're there (Admin->People).

The problem is when I try to do it in my website with PHP. I send the same fields changing the unique_id and so, and I get a http_code 403 "forbidden".

I've also tried with jQuery and get a "Status code 200 OK", but in the console I get 

Cross-Origin Read Blocking (CORB) blocked cross-origin response "https://url" with MIME type application/json.

I've added my website to "Admin-Settings-Trusted HTTP websites" and still get the same errors.


Update: it seems that I need OAuth2 verification ( OAuth2 - Canvas LMS REST API Documentation ). I should send a request loging in with my user in order to get another token, and then send the request to create the user with that new token so I have permission. But how/where do I use it? The documentation doesn't say anything about it (Create a user: Canvas LMS REST API Documentation ).

I'm testing it and get a "You are being redirected." message, it goes to a login site and that's it. I have already added the link to where it should redirect in  "Developers keys->Redirect URIs", but I don't know who has to log in, the user (whose account doesn't exist yet) or the admin of the courses, which doesn't make sense.