Kennethware 2.0 deployment testing errors

Jump to solution
tatiana_peisl
Community Novice

Kennethware-2.0: Deployment testing errors

We do have  ID and  Developer Key, and   when adding Kennethware 2.0 to canvas course use   suggested XML-> all code is obtained form github

Anyone know why $url will be  malformed?

Note>>In Warning test posted here , I replaced “client_id”  and “code” with XXXX  just for this posting, in fact they are
existing data, ID is what canvas assign and CODE -> seem to be encrypted

Is it  a Developer Key that  is failed to be  properly  encrypted/decrypted and that is why  I’m getting the error? Or something else?

Any ideas how to get around that?

----------------------Error returned---------------------

Strict Standards: Declaration of
TrivialOAuthDataStore::new_request_token() should be compatible with
OAuthDataStore::new_request_token($consumer, $callback = NULL) in /home4/iucdtcom/public_html/user/~tatiana/kennethware/wizard/resources/TrivialOAuthDataStore.php
on line 45

Strict Standards: Declaration of
TrivialOAuthDataStore::new_access_token() should be compatible with
OAuthDataStore::new_access_token($token, $consumer, $verifier = NULL) in /home4/iucdtcom/public_html/user/~tatiana/kennethware/wizard/resources/TrivialOAuthDataStore.php
on line 45

Warning:
file_get_contents(https://cehe.instructure.com/login/oauth2/token?client_id=xxxxxxx&client_secret=secret&code=xxxxxxxx...
failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home4/iucdtcom/public_html/user/~tatiana/kennethware/wizard/oauth2response.php
on line 14

---------------------------------------------------------------------------------------------

Oath2response.php code is as follow:

Line #9:  // get code query parameter from POST data

Line #10:              $opts = array('http' => array( 'method' => 'POST', ));

Line #11:              $context  = stream_context_create($opts);

Line #12               $url=$_SESSION['canvasURL'].'/login/oauth2/token?client_id='.$client_id.'&client_secret='.$clientSecret.'&code='.$_GET['code'];

Line #13:              //OPTION 1

Line#14:                $userTokenJSON= file_get_contents($url, false, $context, -1, 40000); //ASK CANVAS,   USING DEVELOPER TOKEN, TO RETURN STUDENT
TOKEN

--------------------------------------------------------------------------------------------------------

And the line 45 in  TrivialOAuthDataStore.php, is just  end of procedure. Code is loaded from github.

Line 1: <?php

Line 2:

Line 3: /**

Line 4:  * A
Trivial memory-based store - no support for tokens

Line 5:  */

Line 6: class TrivialOAuthDataStore extends
OAuthDataStore {

Line 7:     private
$consumers = array();

Line 8:

Line 9:     function add_consumer($consumer_key,
$consumer_secret) {

Line 10:         $this->consumers[$consumer_key] =
$consumer_secret;

Line 11:     }

Line 12:

Line 13:     function lookup_consumer($consumer_key) {

Line 14:         if
( strpos($consumer_key, "https://" ) === 0 ) {

Line 15:             $consumer = new
OAuthConsumer($consumer_key,"secret", NULL);

Line 16:             return $consumer;

Line 17:         }

Line 18:         if
( $this->consumers[$consumer_key] ) {

Line 19:             $consumer = new
OAuthConsumer($consumer_key,$this->consumers[$consumer_key], NULL);

Line 20:             return $consumer;

Line 21:                     }

Line 22:                     return NULL;

Line 23:                 }

Line 24:            

Line 25:                 function lookup_token($consumer,
$token_type, $token) {

Line 26:                     return new OAuthToken($consumer,
"");

Line 27:                 }

Line 28:            

Line 29:                 // Return NULL if the nonce has not been
used

Line 30:                 // Return $nonce if the nonce was
previously used

Line 31:  
function lookup_nonce($consumer, $token, $nonce, $timestamp) {

Line 32:        //
Should add some clever logic to keep nonces from

Line 33:        //
being reused - for no we are really trusting

Line 34:        //
that the timestamp will save us

Line 35:      
return NULL;

Line 36:    }

Line 37:

Line 38:  
function new_request_token($consumer) {

Line 39:      
return NULL;

Line 40:    }

Line 40:

Line 41:  
function new_access_token($token, $consumer) {

Line 42:      
return NULL;

Line 43:    }

Line 44:}

Line 45:?>

---------------------------------------------------------------------------------------

Thanks in advance

T.Peisl

Independence University

1 Solution
kenneth_larsen
Community Champion

Hi  @tatiana_peisl ​,

It would appear that you entered the word "secret" on line 28 of your config.php file instead of the client secret that was supplied to you by Canvas along with your client ID. Both the client ID and the client secret that you received from Canvas are required in order to request an OAuth token.

Let me know if that still doesn't fix it.

View solution in original post