Loading an LTI as a user via the API

Jump to solution
JacobDyer
Community Member

Hi all,

I'm part way through developing a script to scrape a course and find all instances where we use a specific API (Echo360 for those interested). For _reasons_ I need to then load that LTI so I can the final redirected URL where it lands. It's not sufficient to grab the URL from the Canvas page, I need it to fully load.

Is there any way to do that using the API to authenticate? Currently I just get a login page when I try to load the page via my Python script. Can I make a request to Canvas via the API that would return the fully loaded page, authenticated by my token (or as a specific user?)

Any help would be appreciated.

Cheers,
Jacob.

Labels (3)
0 Likes
1 Solution
matthew_buckett
Community Contributor

You can use this API to get a normal browser based session (with cookies) from an API call: https://canvas.instructure.com/doc/api/file.oauth_endpoints.html#get-login-session-token

So if you can then get your python client to keep the cookies you can then "launch" the LTI tool and grab the final URL that your python clients ends up at.

We've used that endpoint for doing browser test automation with things like https://playwright.dev/ reasonably successfully. Our test just has a API token which it then uses to get a full browser session.

View solution in original post