MDL-56737 externallib: Fetch token after inserting
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 8 Nov 2016 04:45:57 +0000 (12:45 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 8 Nov 2016 04:45:57 +0000 (12:45 +0800)
lib/externallib.php

index 9257f82..3eaee4f 100644 (file)
@@ -1057,6 +1057,7 @@ function external_generate_token_for_current_user($service) {
             // Generate the private token, it must be transmitted only via https.
             $token->privatetoken = random_string(64);
             $token->id = $DB->insert_record('external_tokens', $token);
+            $token = $DB->get_record('external_tokens', ['id' => $token->id]);
 
             $params = array(
                 'objectid' => $token->id,