Webservices/auth/mobile

Webservices/auth/mobile

by Bindu Wavell -
Number of replies: 4

Hey folks, I'm interested in mocking up a basic moodle client using Flex… It looks to me like the official moodle iPhone app can auth using a users username and password, can anyone point me to doc on how this is done?

Average of ratings: -
In reply to Bindu Wavell

Re: Webservices/auth/mobile

by Bindu Wavell -

Using a packet sniffer I discovered that the iPhone client posts to:

http://yourmoodleserver.com/<path-to-moodle>/login/token.php

With a POST body of:

username=<username>&password=<password>&service=moodle_mobile_app

Assuming valid username and password this will return a token that can be used for this user.

subsequently the client calls:

http://yourmoodleserver.com/<path-to-moodle>/webservice/xmlrpc/server.php?wstoken=<token-obtained-above>;

with an xml rpc body that requests the: moodle_webservice_get_siteinfo function/method like so:

<?xml version="1.0"?><methodCall><methodName>moodle_webservice_get_siteinfo</methodName><params></params></methodCall>

In my case I'm using rest so instead of xmlrpc in the url I have rest and I append &wsfunction=moodle_webservice_get_siteinfo

I had to enable REST access for all authenticated users, which I did via: Site administration > Users > Permissions > Define roles > Authenticated user

In reply to Bindu Wavell

Re: Webservices/auth/mobile

by Frank Ralf -
Hi Bindu,

http://docs.moodle.org/20/en/Integration_FAQ might give you some additional pointers.

hth
Frank
In reply to Frank Ralf

Re: Webservices/auth/mobile

by Bindu Wavell -

Thanks for the pointer Frank, I didn't find anything on that page directly related to my question. Are there particular links on there that I should follow up on?


TIA!