Adding Course Content through API calls

I'm following the https://community.d2l.com/brightspace/kb/articles/1529-adding-course-content using Postman. I've followed most of the tutorials on the site with success with this one exception. When I run the API call, according to the directions, I get a { Errors: [ {Message: "Insufficient scope to call API.Required: content:modules:read"} ] }. How can fix this?

Tagged:

Answers

  • The application making that API call needs to:

    • be registered as wanting to ask for the content:modules:read scope
    • ask for that scope when requesting an OAuth2 access token
    • actually be given an access token that does have this scope (if the app meets the first two bullets, this bullet should take care of itself)
  • Justin.B.253
    Justin.B.253 Posts: 35 🌱

    @Viktor Haa62 and @Andrea Bla691 Thank you for that information, I'm new to this and just started playing last night. I created the new authorization and added the correct scope but I'm now getting this error message when I click Get New Access Token.

    {"error":"invalid_scope","error_description":"Client is not authorized to request the scope content:modules:read"}

    If I'm the administrator to the system, shouldn't I be authorized?

    Thank you,

    Justin Bamberg

  • Justin,

    Can you confirm that the application whose OAuth credentials you are using to make these calls also has the above scope added? You can find this information by:

    • Navigate to the admin "cog"
    • Locate and click the "Manage Extensibility" item
    • Locate and click the "OAuth 2.0" tab
    • Locate and edit your application
    • Ensure the scope field includes the scope above (content:modules:read), and any other relevant scopes

    Follow Viktor's steps again and hopefully, you are able to generate a valid token.

    Cheers,

  • Justin.B.253
    Justin.B.253 Posts: 35 🌱

    @Joshua Vie797 Thank you, that worked. I didn't know that I could add multiple scopes in the application on D2L. I appreciate your help as I continue to learn.