AGS Invalid access token format/ Access token invalid

Jump to solution
ImreKinnunen
Community Explorer

I'm working on assignment grading external tool for Canvas and got stuck when trying to access the LTI API.

The end goal is to save the student's result from the external tool in Canvas. Trying to achieve this with line items / LTI 1.3 Assignment and Grading Services.

After completing the OAuth2 Client Credentials Grant, the API does not accept my access_token.

When sending a get request to https://canvas.example.com/api/lti/courses/7264/line_items

with the access_token as a bearer I'm getting a response "Invalid access token format", even though the token is fresh and works with the api routes in this format https://canvas.example.com/api/v1 .

Strangely, when I enter a JWT id_token (sent to my by canvas via the JWT authentication method) as a bearer for the same request the error is no longer about the token format, the message returned is "Access token invalid - signature likely incorrect". However, the api documentation states that Oauth2 access_tokens, not id_tokens should be used with AGS.

Thank you for any tips! Please let know if you need additional information.

 
0 Likes
1 Solution
ColinMurtaugh
Community Champion

Are you sure that you used "grant_type=client_credentials" when you requested the token? If the token you have works with the Canvas API (as opposed to the LTI Advantage Services API), then it sounds like it was requested with "grant_type=code" or "grant_type=refresh_token" instead. 

--Colin

View solution in original post