Oauth using OpenStreetMap (aka OSM)

Oauth using OpenStreetMap (aka OSM)

by Rafael Ávila Coya -
Number of replies: 4

Hi:

I am not expert in OAuth2 authentication. I am testing with a moodle 3.9 in my own computer, to allow OAuth 2 login with OpenStreetMap as issuer.

The OAuth issuer details for RafaelMoodleSite are as follows:

Consumer Key: ynaky...

Consumer Secret: DaYSN...

Request Token URL: https://www.openstreetmap.org/oauth/request_token

Access Token URL: https://www.openstreetmap.org/oauth/access_token

Authorise URL: https://www.openstreetmap.org/oauth/authorize

Requesting the following permissions from the user:

  • read their user preferences.

We support HMAC-SHA1 (recommended) and RSA-SHA1 signatures.

---

On my Moodle server I set:

Name: OSM

Client ID: ynaky...

Client secret: DaYSN...

Authenticate token requests via HTTP headers: didn't select it. 

Scopes included in a login request: openid profile email

Scopes included in a login request for offline access: openid profile email

Additional parameters included in a login request: (empty)

Additional parameters included in a login request for offline access: (empty)

Service base URL: (empty)

Login domains: (empty)

Logo URL: (empty)

Show on login page: I've selected it.

---

But when clicking in OSM button in the login frontpage, I get the following page:

Oauth error screenshot

The OpenStreetMap OAuth 2 info is here: https://wiki.openstreetmap.org/wiki/OAuth

Does anyone know what I am missing in the configuration?

Average of ratings: -
In reply to Rafael Ávila Coya

Re: Oauth using OpenStreetMap (aka OSM)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Have you set the Callback URL in OSM? I think this would be https://moodle.example.com/admin/oauth2callback.php (where https://moodle.example.com is your site's URL).

In reply to Leon Stringer

Re: Oauth using OpenStreetMap (aka OSM)

by Rafael Ávila Coya -
I have done that and tested it again, but same result...
In reply to Rafael Ávila Coya

Re: Oauth using OpenStreetMap (aka OSM)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

It looks like OSM only supports OAuth 1.0 and Moodle only supports OAuth 2 so I don't think this will work.

I think if you wanted to add OAuth 1.0 support in Moodle you'd have to develop a plugin. There's an old plugin, WordPress authentication, which supports OAuth 1.0. It's specific to WordPress, contains deprecated code and isn't used like a normal authentication plugin but it could be a starting point for development (with some quick-and-dirty changes I managed to get it working with Moodle 3.5 and OSM).

Average of ratings: Useful (1)