Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Chris Pratt -
Number of replies: 14

Moodle 3.1.1+ enabled Web Services but still no joy? 

Site is vle.wilberforce.ac.uk (no https at the moment), not even prompted for username and password. 

All help appreciated 

Thanks 

Chris 


Average of ratings: -
In reply to Chris Pratt

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Chris,

the mobile app performs a request to login/token.php with fake credentials just to validate it's a valid Moodle site. The usual response to this request is:

Status Code 200 OK

{"error":"Invalid login, please try again","stacktrace":"* line 110 of \/login\/token.php: moodle_exception thrown\n","debuginfo":"\nError code: invalidlogin"}

But in your site it's returning the following:

Status Code 500 Internal Server Error

Default exception handler: Invalid login, please try again Debug: 

Error code: invalidlogin

* line 208 of \login\token.php: moodle_exception thrown

Have you modified the login/token.php script? Are you using some kind of proxy to authenticate? Also, do you know where is your Moodle hosted?

The request done by the app is the following:

http://vle.wilberforce.ac.uk/login/token.php?username=a&password=b&service=c

Kind regards,

Dani

In reply to Dani Palou

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Chris Pratt -

Thanks for the reply. From inside the network Moodle is set to use NTLM with LDAP and anything else is just the usual form login. Moodle is hosted onsite and I have full admin access to it. As far as I am aware not change has been made to token.php.

In reply to Chris Pratt

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Chris,

that's really weird. Can you send us your login/token.php script via mail to mobile@moodle.com? Also, do you have any security extension in your site (either PHP or server level) that could affect this?

Cheers,

Dani

In reply to Dani Palou

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Chris Pratt -

Hi Dani

I've sent that over to you now. And I'm not aware of anything like that, is there any way I could double check?

Thanks

Chris


In reply to Chris Pratt

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Chris,

we haven't received anything. Maybe the mail was blocked because it contained a PHP script? 

Cheers,

Dani

In reply to Dani Palou

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Chris Pratt -

Hi Dani

That is possible. I'll try my GMail account, on it's way now.

Thanks

Chris

In reply to Chris Pratt

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Chris,


I've been talking with Dani and your token.php script seems fine, but there is something in your Moodle installation that is making the site to return exceptions in a different format.

Are you sure that you are using a standard Moodle installation? Do you have any plugin installed that could be replacing the default exception handler in Moodle?

I remember a similar issue, see https://moodle.org/mod/forum/discuss.php?d=261992&parent=1137317 in this case, the source code had modifications to when a moodle_exception is thrown a '500 Internal Server Error' status code is returned

Regards, Juan

In reply to Juan Leyva

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Chris Pratt -

Hi Juan

Our server was upgraded last week to the latest version of Moodle (3.1.1+ Build: 20160804) by our support company. The only things different to a standard install that I can see on the installed plugins list is the Essential theme, Grade Me plugin, Poll plugin, Progress Bar plugin, Grid Format and some ATTO plugins.

Web server is IIS on Windows 2008 R2 64bit, MySQL, PHP 7.0.9. Authentication is done via NTLM and LDAP onsite and normal form login offsite. URL Rewrite 2.0 is installed.

In reply to Chris Pratt

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Chris Pratt -

Any further ideas? 

In reply to Chris Pratt

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Chris,

I'm sorry but not, your site is returning exceptions in plain format, can you check if your server is in some what filtering the PHP output avoiding the use of json responses?

Juan

In reply to Juan Leyva

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Chris Pratt -

I think I found the solution to this. Debugging was enabled but set to minimal. Changed to none and now can log in. Thanks for all the help.

In reply to Chris Pratt

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Swapnil Shinde -



login/token.php

Version: 3.2+ (Build: 20161215)

Encountered same error, when wrong credentials entered it throws following error

Tried Chris' solution, didn't work, any idea?

<br />
<b>Error</b>: <font color="FF0000"><b>Internal script failure</b><br />

In reply to Swapnil Shinde

Re: Getting Error when login- Cannot Connect: Verify that you have typed correctly URL and that your site uses Moodle 2.4

by Swapnil Shinde -

This is from the log



2017/04/12 15:19:47 [error] 15634#15634: *9028 FastCGI sent in stderr: "PHP message: Debugging: The authentication method db is not configured. in
* line 62 of /auth/db/auth.php: call to debugging()
* line 4301 of /lib/moodlelib.php: call to auth_plugin_db->user_login()
* line 52 of /login/token.php: call to authenticate_user_login()

PHP message: PHP Notice:  Undefined property: stdClass::$proxycas in .com/ProductPage/csa/auth/cas/auth.php on line 191
PHP message: PHP Notice:  Undefined property: stdClass::$casversion in .com/ProductPage/csa/auth/cas/auth.php on line 194
PHP message: PHP Notice:  Undefined property: stdClass::$hostname in .com/ProductPage/csa/auth/cas/auth.php on line 194
PHP message: PHP Notice:  Undefined property: stdClass::$port in .com/ProductPage/csa/auth/cas/auth.php on line 194
PHP message: PHP Notice:  Undefined property: stdClass::$baseuri in .com/ProductPage/csa/auth/cas/auth.php on line 194" while reading response header from upstream