Attributes for the current user#

Attributes for the logged in user are available through this API, which is also called “extended userinfo”. It is only available for users logged in with a Feide account.

API endpoint#

https://api.dataporten.no/userinfo/v1/userinfo

Example#

The testuser asbjorn_elevg@testusers.feide.no is logged in and has the scopes userid-feide and userinfo-name in the access token. The endpoint is called like so:

curl -sSLf -H 'Authorization: Bearer ....' \
'https://api.dataporten.no/userinfo/v1/userinfo'

This gives the following output:

{
    "sub": "af761fdb-71fa-484b-9782-ababdc739559",
    "cn": [
        "Asbj\u00f8rn ElevG Hansen"
    ],
    "displayName": "Asbj\u00f8rn ElevG Hansen",
    "eduPersonPrincipalName": "asbjorn_elevg@testusers.feide.no",
    "givenName": [
        "Asbj\u00f8rn ElevG"
    ],
    "sn": [
        "Hansen"
    ],
    "uid": [
        "asbjorn_elevg"
    ]
}

Return values#

The API returns a JSON object containing the user attributes. The keys in the returned object are the attribute names. The available attributes page lists the attributes that may be included in the response and the attribute groups required to access them.

Errors#

The API returns 401 Unauthorized when the access token is missing, invalid or expired.

It returns 403 Forbidden when the access token is not associated with a logged in user.

It returns 404 Not Found when the logged in user is not a Feide user, or when the user cannot be found.