Getting a web service token with SSO

Getting a web service token with SSO

by Gordon Alexander -
Number of replies: 4

HI

We have a web portal which uses the Moodle web services to get timely information from Moodle. To do this we need to get the web service token.

If the Moodle is not using SSO this is simple, just call /login/token.php.

If the Moodle is behind SSO we can redirect to /admin/tool/mobile/launch.php but this will not redirect back to our domain. It will only redirect back to a url scheme, for example, moodlemobile://token=????. This is fine if we are in the native app version of our product because we can catch the url scheme and extract the token from it. However this will not work on the web portal as the browser doesn't recognize the url scheme and the redirect doesn't contain our domain.

How can we get a web service token for our web portal? This is simple in both Canvas and Blackboard but appears to be impossible in Moodle.

Thanks

Gordon Alexander


Average of ratings: -
In reply to Gordon Alexander

Re: Getting a web service token with SSO

by Dorel Manolescu -
Picture of Plugin developers
Hi
Did you try this:
https://moodle.org/plugins/auth_userkey ?
Regards
In reply to Dorel Manolescu

Re: Getting a web service token with SSO

by Gordon Alexander -

Hi Dorel

Thanks for responding. I've had a look at the plugin but it seems to be for logging in to Moodle not for getting a token.

I'm happy for the user to have to log in to Moodle the normal way, I just need to be able to get a token so they can use the web services in the context of their user

Thanks

Gordon


In reply to Gordon Alexander

Re: Getting a web service token with SSO

by Dorel Manolescu -
Picture of Plugin developers
Hi Gordon,
I understand. In that case you may want to have a look on how the moodle app is doing that. Seems to me you want a similar behaviour. Based on my understanding a token is generated every time a user is connecting to the app and that token is used to manage user activity on the app.
Regards
In reply to Gordon Alexander

Re: Getting a web service token with SSO

by Eric Katchan -

Hello Gordon, I was wondering if you found a solution.  We are going to implement a single signon "hub" and attempt to display some moodle information - user courses for example within the hub.


Thanks and happy holidays.