Using OKTech web services to log in

Re: Using OKTech web services to log in

by Ramakant Kulkarni -
Number of replies: 0

Let me attempt to describe the problem in a different way.

I do use the webservice login function to login and get the client and sesskey as a return. I agree with the usage of web services for getting courses, sections, users...

The point I was trying to make is, courses in moodle can have topics. Topics can have resources of type HTML. And the HTML that is loaded as a topic can have images in it. You can use the "get_sections" function to get the topics under a course and "get_resources" to get the resources associated with the topics. The output of get_sections will tell you the sequence in which the resources appear. Images are loaded in moodle and will have a url of something like

If I have 2 users enrolled in the same course, one (user1) with authentication type of manual and the other (user2) with authentication type of webservices. If I use user1's credentials in the web service or user2's credentials for login via browser I get an "invalid user" error. They have to be used in their respective authentication types to login successfully. This seems to be the how moodle authentication works.

Here's the problem: The "get_resources" function of web services will give me the contents of the html file uploaded (as "alltext" tag). That html file also contains the path to the images. Now if I have to render this html on a mobile device using the data I received from the webservice, I need to render the images as well. Is there a way to get access to these images to user2 (with authentication method of web service). When user1 visits the same course via browser, he sees the content properly.

If I use the MoodleSession and MoodleSessionTest cookies of user1 and hardcode them into the mobile version of my moodle client, the images show up properly as well on my mobile device. I am looking for a way where user2 can see the contents, as user1 would see in the browser. If manual and webservice authentications were treated similar in giving access to resources, the problem would be solved or if user2 could login both via browser and via webservice at the same time, this problem could be solved. Hope I was able to clearly state the problem.