OAuth2 User Profile Fields

OAuth2 User Profile Fields

by Stephen Armitage -
Number of replies: 5

I'm needing to include two user profile fields from Microsoft into Moodle 3.3 using OAuth 2.

These fields are "occupation" and "department". 

Does anyone know how to include this data into a new profile?

Attached photo shows how our Microsoft Account details are step up.


Attachment Capture.PNG
Average of ratings: -
In reply to Stephen Armitage

Re: OAuth2 User Profile Fields

by Logan Thomison -

I'm looking to do the same thing with the various providers as well. 

In reply to Stephen Armitage

Re: OAuth2 User Profile Fields

by Les Bell -

Not that I've even got the core OAuth2 module working properly yet, but: have you looked at the configurable field mappings for the issuer? On Site administration -> Sever -> OAuth 2 services, click on the "bust" (the little head and shoulders icon) to the right of your Microsoft service. You may have to create a new user field mapping, but if you know what Microsoft and Moodle each call those fields, you should be able to set it up there.

--- Les

In reply to Les Bell

Re: OAuth2 User Profile Fields

by Hu La -

I can do with Google OAth2 but Microsoft and facebook. what is the significant differences between them

In reply to Stephen Armitage

Re: OAuth2 User Profile Fields

by Storm Nameless -

Another topic-related question: does moodle accept dot-notation or something in user field mappings?

For example, if userinfo endpoint of oAuth2 service gives us:

{"status":"success", "data":{"fname": "John", "lname": "Doe"}}

Can we specify `data.fname` for `firstname` user field?

Unfortunately there is nothing about it at https://docs.moodle.org/dev/OAuth_2_API#User_field_mappings