kanboard / plugin-oauth2

Generic OAuth2 authentication plugin
MIT License
27 stars 33 forks source link

fix getKey error when userinfo with nested structure #16

Closed renothing closed 5 years ago

renothing commented 5 years ago

for example some OAuth2 provider provide multiple emails like this:

{
  "_id": "aobEdbYhXfu5hkeqG",
  "name": "Example User",
  "emails": [
    {
      "address": "example1@example.com",
      "primary": true
    },
    {
      "address": "example2@example.com",
      "primary": false
    }
  ],
  "status": "offline",
  "statusConnection": "offline",
  "username": "example",
  "utcOffset": 0,
......

we need get email address for email map in kanboard.

this patch use . as separator to get value from nested structure.

in this example we can use emails.0.address as key name to get first email address.

fguillot commented 5 years ago

Can you rebase your branch against master to make the tests pass?