OpenID Connect - undefined method error

OpenID Connect - undefined method error

by Justin McElvaney -
Number of replies: 9

A couple days ago the following error message began presenting anytime a login is attempted via OpenID Connect / AzureAD:

Exception - Call to undefined method auth_oidc\oidcclient::use_chinese_api()

Nothing changed on the Azure side and it doesn't appear anything changed in Moodle. No idea what it is looking for or how to fix but its prevented all logins using the Microsoft credential to login.

Average of ratings: -
In reply to Justin McElvaney

Re: OpenID Connect - undefined method error

by Elín Jóna Traustadóttir -

Hi I also have this problem, anyone got the answer??

In reply to Elín Jóna Traustadóttir

Re: OpenID Connect - undefined method error

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

What version of the OpenID Connect plugin have you got? It looks like the very latest version, 2020020301 released 15 May 2020, added a call to oidcclient::use_chinese_api() but didn't actually add the corresponding method.

I've added a report (#1267) to the third party's bug tracker.

In reply to Leon Stringer

Re: OpenID Connect - undefined method error

by Justin McElvaney -

3.8.0.1   2020020301

No luck figuring this one out for me still unfortunately.

In reply to Justin McElvaney

Re: OpenID Connect - undefined method error

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Sorry if I wasn't clear: it looks like this is a bug in the third party code in that version.

In reply to Leon Stringer

Re: OpenID Connect - undefined method error

by Elín Jóna Traustadóttir -
Yes I have this version, so what do we do just wait?

In reply to Elín Jóna Traustadóttir

Re: OpenID Connect - undefined method error

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Yes, you can keep an eye on that bug report for any updates from the developers.

If you're not using Office 365 for China you could edit auth/oidc/classes/oidcclient.php changing line 69 from:

            $this->resource = (static::use_chinese_api() === true) ? 'https://microsoftgraph.chinacloudapi.cn' : 'https://graph.microsoft.com';

to:

            $this->resource = 'https://graph.microsoft.com';

Please note that I haven't been able to test this.

Depending on your situation there may be the option of uninstalling the plugin and reverting to the previous version, the bottom of the plugin Versions page allows you to switch to 3.8.0.0. You might need to revert Microsoft Office 365 Integration (local_o365) too. This might be fine for a new site but for an established site with lots of affected users it might be more difficult.

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: OpenID Connect - undefined method error

by Elín Jóna Traustadóttir -
Thanks, I just recently updated my Moodle but I am not in a hurry to fix this since the school is out.
I hope they will send an update soon.
In reply to Leon Stringer

Re: OpenID Connect - undefined method error

by Justin McElvaney -

That modification fixes it. I'll keep an eye on the bug tracking but for now it seems that is all it needed. Thanks!

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: OpenID Connect - undefined method error

by Jeff Shelp -

Modifying the file worked for me...thank you!!