Add a second login via import or using the API?

Jump to solution
msanders
Community Contributor

We have standardized the Canvas usernames/passwords assigned to students but they are unfortunately too complex for our younger students. I would like to assign these students a simple username/password combination to use while in K-3. It would be great if I could add the simpler logins to the user's accounts instead of overwriting the standard combination.  I know I can manually add a second login but is there a way to add a second login via import or API? I didn't see anything in the documentation but thought I'd ask.

1 Solution
bduggan96
Community Explorer

Hello!

I was looking to do a similar task of adding a second login via API, as we are overhauling our adfs SSO mapping to better match our SIS.  With that said, I have linked my GitHub (Link 1) below to be able to copy my Python script.  I have also attached the documentation upon which I used to build this code (this article being one of them).  Essentially, you only need to create an API bearer token within Canvas (Link 2), copy that key into the two API fields within the Python Code which is commented, add in your school's URL link which is also commented, and tweak the code so that it is adding the desired secondary login to your Canvas account.

 

Currently the code runs and creates a secondary login with the user's email, whose initial login username is a SIS provided username.  You are able to change that field to whatever you would like as the POST request, but do ensure that they are unique usernames (ID number, email address, etc.)  It will also create a .txt document to show a log of students who were changed and/or ignored.

 

If you are wanting to update everyone's login credential, I would utilize the SIS Import feature (Link 3).  You possibly could change the Python script to have a PUT request instead, that also should work, but I would certainly recommend testing both of these scripts on your test site before moving on to your production site.

 

Depending on how many users you have, this code could take anywhere from 20min to 2hrs to run as it goes through every user and their login credentials.

Hope this is helpful!

Link 1: https://github.com/switchroute/Python/blob/master/canvasloginpostapicall.py

 

Link 2: https://community.canvaslms.com/t5/Admin-Guide/How-do-I-manage-API-access-tokens-as-an-admin/ta-p/89

 

Link 3: https://canvas.instructure.com/doc/api/file.sis_csv.html

View solution in original post

0 Likes