cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Team
Community Team

All things API

Have a question about the Canvas APIs? Have a cool API integration you'd be willing to share? If so, please post here.

Labels (1)
Tags (1)
271 Replies
Highlighted

Gerald, thanks again.

The first link, I've followed the steps, but I can't find the "lti2_consumer" table in my Homestead database. (I have to use Homestead for the time being).

The second, I've git-pulled now into my working project. I'm just not sure how to apply it to my code.

The third link, I appreciate the example, though I don't want to write my own LTI from scratch.

The fourth, it’s informative like the Passport documentation. Though sadly I don’t think my project will allow me the timeframe to build my own LTI, unless it’s absolutely necessary. 

 

Maybe it’d help if I were more specific. In my past projects, I get information from Canvas via making cURL requests to Canvas endpoints. e.g.

$courseURL = "https://my.test.instructure.com/api/v1/courses";
$myToken = $this->token; //"13518~bCaXKavhv1N2tZ7d2eZ6bQ1k2TisiYyVHEBN2XiEuL1mBOJplS4fi7kOrhPiaIbG"; //$this->token;
$headers = ["Authorization: Bearer " . $myToken];
$curl = curl_init();

curl_setopt_array($curl, [
   CURLOPT_RETURNTRANSFER => TRUE,
   CURLINFO_HEADER_OUT => TRUE,
   CURLOPT_URL => $courseURL,
   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
   CURLOPT_SSL_VERIFYPEER => TRUE,
   CURLOPT_HTTPHEADER => $headers,
   CURLOPT_CUSTOMREQUEST => 'GET',
   CURLOPT_HEADER => TRUE
]);

As best as I understand it, this is how I can code a program that can interact with Canvas and retrieve data. But none of the documentation I’ve seen on Canvas suggests anything similar, or anything possible. I’m not sure how to make head to toe of even its LTI documentation as a result; how exactly is code supposed to look like for it?

Highlighted
Community Member

I've been reviewing the Canvas documentation of OAuth2 endpoints, as in this link.

From here, it shows this example of what a redirect example looks like:

GET https://<canvas-install-url>/login/oauth2/auth?client_id=XXX&response_type=code&state=YYY&redirect_u...

I'm having trouble developing my own OAuth2 redirect right now: to help pinpoint the problem, I want to confirm if I understand this part correctly. In my example, could it look like this?

https://my.test.instructure.com/login/oauth2/auth?client_id=1&response_type=code&state=*&redirect_ur...

Or even like this?

https://my.test.instructure.com/login/oauth2/auth?client_id=7&response_type=code&state=&redirect_uri...

Any clarity would be greatly appreciated.