I dont really know why saying invalid client secret – I can't help you there but that's why you're getting the error in Moodle, the Microsoft server is rejecting the secret.
Leon,
I have managed to get a step closer. Now I am running into this issue. I am running MOODLE 3.11 - Please remember I am trying to have users with gmail account be able to register/login
Exception - Argument 1 passed to core\oauth2\client::map_userinfo_to_fields() must be an instance of stdClass, null given, called in [dirroot]/lib/classes/oauth2/client.php on line 504
When I check the client.php on line 504 this is what is there and I dont know how to proceed from here;
return $this->map_userinfo_to_fields($userinfo);
Any help is highly appreciated
Thnx
I have managed to get a step closer. Now I am running into this issue. I am running MOODLE 3.11 - Please remember I am trying to have users with gmail account be able to register/login
Exception - Argument 1 passed to core\oauth2\client::map_userinfo_to_fields() must be an instance of stdClass, null given, called in [dirroot]/lib/classes/oauth2/client.php on line 504
When I check the client.php on line 504 this is what is there and I dont know how to proceed from here;
return $this->map_userinfo_to_fields($userinfo);
Any help is highly appreciated
Thnx
Moodle is calling the OAuth 2 issuer's userinfo endpoint URL to get the user's details. Moodle expects the details in a JSON message but it looks like the issuer is sending something else.
Try adding this moodle_exception before the return:
504 throw new moodle_exception('generalexceptionmessage', 'core', '', "JSON: $response");
505 return $this->map_userinfo_to_fields($userinfo);
When you try to log in using OAuth 2 you will get an error which will show the issuer's response (after "JSON:").
You may need to check the URL for the userinfo endpoint and any mapped fields re correct.
I should add: you must have debugging enabled (Debug messages: DEVELOPER and Display debug messages: Yes) to see the message.
Hi Leon,
I think after adding the line within client.php before line 504, it was able to register a user. But after a successful registration I have this errors display. How can I solve this;
*********** ×Stack trace: **************
I think after adding the line within client.php before line 504, it was able to register a user. But after a successful registration I have this errors display. How can I solve this;
*********** ×Stack trace: **************
line 497 of /lib/setuplib.php: moodle_exception thrown
line 26 of /admin/settings.php: call to print_error()
Leon,
I think Google login has worked fine. Now using Microsoft login, I run into the following error. The site is www.giantpedia.com. If you have a hotmail account, you can run a test on that website
Could not upgrade OAuth 2 token. HTTP status for remote endpoint: 401
I think Google login has worked fine. Now using Microsoft login, I run into the following error. The site is www.giantpedia.com. If you have a hotmail account, you can run a test on that website
Could not upgrade OAuth 2 token. HTTP status for remote endpoint: 401
Thnx
Aren't we back to the beginning of this thread, i.e. you're getting a 401 from the issuer? If you enable debugging in Moodle you should see the response from the issuer which may contain more details.