I have put it there, as well as in the Redirect URI (legacy) box. Here is a screencap:
This also matches the redirect URI in the code that points to Canvas' OAuth2 authentication.
I will note that these redirects work for other elements. Namely, if I change my redirect route to any other page, it works. If I point to any other redirect route that I've coded, it also works.
This block of code - which I'm initially asking Canvas to redirect to after authorisation - is the problem. I was advised on this block of code by numerous laravel passport tutorials and official documentation. I'm aware laravel is not the specialty of many people here, but in case it is of use:
Route::get('/callback', function (Request $request) {
Log::info("Entered callback");
$state = $request->session()->pull('state'); //is returning null
throw_unless(
strlen($state) > 0 && $state === $request->state,
InvalidArgumentException::class
);
$http = new GuzzleHttp\Client;
$response = $http->post('http://my.test.instrucutre.com/login/oauth2/auth?', [
'headers' => [
'Accept' => 'application/json',
],
'form_params' => [
'grant_type' => 'authorization_code',
'client_id' => '10', //only a client ID in my laravel homestead database
'client_secret' => 'DKwYRnNg30GVcIYKiRRwtPpCIiVb8FBYZft5iBYqx', //corresponding client secret for laravel database
'redirect_uri' => '192.168.10.10/callback',
'code' => $request->code,
],
]);
return json_decode((string) $response->getBody(), true)['access_token']; //returns null
});
I was recommended to use Passport in order to be able to use OAuth2 on Canvas, but now I'm wondering if there was some confusion, if that recommendation was accurate to my problem. If my project is already using Canvas, and I can make clients on it, and I can authorise those clients, is Passport essentially doing the same thing? Is this essentially a redundancy?
EDIT: It might also be worth noting that, even in the cases of successful redirects by the OAuth2 server, I'm not sure where to see the access token that I hear is generated.