Automatic Login based on printed QR Code

Re: Automatic Login based on printed QR Code

από Dani Palou -
Αριθμός απαντήσεων: 1
Φωτογραφία Core developers Φωτογραφία Moodle HQ Φωτογραφία Particularly helpful Moodlers Φωτογραφία Peer reviewers Φωτογραφία Plugin developers

Hi Angelo,

the automatic QR login supported by the app has some security restrictions to make it more secure, like being in the same network like you commented or having a short expiration time.

AFAIK you can create some "permanent" QR codes manually, I think it should work. If you check the Moodle App Deep Linking guide you will see that you can define some URLs to launch the app. If you include the user token in the URL, the app will use it to automatically authenticate the user.

If a student has already used the app to authenticate he will have a token, you can get it from the Moodle database (table external_tokens). Please notice these tokens expire. You can also create a token manually for each student by going to Site administration > Server > Manage tokens. In there you can specify if you want this token to expire or not (and when).

In the Deep linking guide linked above you'll see that the URL can also include a "privatetoken" parameter. This private token is used to automatically authenticate the student when he opens the browser from the app, so I recommend you to include it too. AFAIK the only way to obtain the privatetoken is to look it at the Moodle database, in the external_tokens table, column privatetoken.

So basically you will need to define a URL like this:

moodlemobile://https://YOURSITE.com?token=TOKEN&privatetoken=PRIVATETOKEN

Then you can convert that URL to a QR code and let your students use it. 

Cheers,

Dani

Σε απάντηση σε Dani Palou

Re: Automatic Login based on printed QR Code

από Dani Palou -
Φωτογραφία Core developers Φωτογραφία Moodle HQ Φωτογραφία Particularly helpful Moodlers Φωτογραφία Peer reviewers Φωτογραφία Plugin developers
For the record, in Moodle 4.0 there will be a new setting to configure the expiration time of QR codes. It can be found in Site administration > Mobile authentication > QR authentication key duration. This setting can help creating printed QR codes, but the network restriction is still there.