Conceptual questions on integration (anonymous + authentication)

Conceptual questions on integration (anonymous + authentication)

by Jairo Portela -
Number of replies: 3

Hi,

We are checking all the paths to integrate a .Net application with Moodle, we would like to redirect our .net application users to Moodle so they can take some courses there but I have some questions:

  1. Is it required to create a user for each account so they can enroll in a course in Moodle? I mean is it possible to have "anonymous" students taking courses in Moodle? Or Guest mode? If student is a guest, can they take a course over several days (progress won't be lost?)?
  2. We would like to authenticate our users from our .Net application and redirect them directly to a course in Moodle, is this possible?

Thanks!

I have also posted this question in SO: https://stackoverflow.com/questions/47448820/moodle-integration-questions 

We are dealing with Moodle version 3.2.2.


Average of ratings: -
In reply to Jairo Portela

Re: Conceptual questions on integration (anonymous + authentication)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

1. You need to create a user for each account. Guests can't really take part in activities and you can't track what they are doing anyway. 

2. Yes. I've done it. If your .Net application is custom then you'll probably need to code something. You can simply create users using Moodle's web services but if you want single sign on then it's a bit more complicated. There are some 'standard' solutions but they can be difficult to get your head around. I tend to use one time tokens that are passed between the two applications. It only needs a few lines of custom code at each end. Here's one way...

- .Net calls Moodle web services to create user account and enrol user on courses
- .Net generates a token (say, random SHA1) and stores it for a short time linked to the user
- .Net redirects to a custom landing script in Moodle (a script in a local plugin)
- Moodle calls .Net to check the token is valid, if so, it calls Moodle's login routines to log the user in. 


Average of ratings: Useful (1)
In reply to Howard Miller

Re: Conceptual questions on integration (anonymous + authentication)

by Jairo Portela -

Hi Howard,

Thanks a lot for the reply, it was really informative.

So it's clear that I need to create users because we need users to take quizes.

Could you please point me to an article or blog or anything with more details about how to do the token part in Moodle? I am ok with .Net but I have no knowledge on Moodle development (PHP or whatever language it accepts)...

Thanks again!

In reply to Jairo Portela

Re: Conceptual questions on integration (anonymous + authentication)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I have no knowledge of .Net development - somebody else did that bit. 

This is were it gets awkward. This stuff is my day job and the work was done for a (paying) client.