Skip to content

Instantly share code, notes, and snippets.

@torgeirl
Last active April 18, 2019 16:54
Show Gist options
  • Save torgeirl/f132527d4831ccebd37e0ab95c80139b to your computer and use it in GitHub Desktop.
Save torgeirl/f132527d4831ccebd37e0ab95c80139b to your computer and use it in GitHub Desktop.
Rocket.Chat custom OAuth settings for Dataporten

Rocket.Chat custom OAuth settings for Dataporten

Simple guide on how to set up Rocket.Chat with Feide login using Uninett's Dataporten service.

Dataporten

If you have selected email, profile, userid and userid-feide as available scopes for your application in the Dataporten Dashboard Rocket.Chat should receive a JSON response similar to this:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
    "user": {
        "userid": "76a7a061-3c55-430d-8ee0-6f82ec42501f",
        "userid_sec": ["feide:[email protected]"],
        "name": "Andreas \u00c5kre Solberg",
        "email": "[email protected]",
        "profilephoto": "p:a3019954-902f-45a3-b4ee-bca7b48ab507"
    },
    "audience": "e8160a77-58f8-4006-8ee5-ab64d17a5b1e"
}

For more details, please read the Dataporten documentation.

Rocket.Chat

As an administrator for a Rocket.Chat instance, click Administration, OAuth and Add custom OAuth, and add the following configuration:

Enable: True

URL: https://auth.dataporten.no

Token Path: /oauth/token

Identity Path: /userinfo

Authorize Path: /oauth/authorization

Scope: email profile userid userid-feide

Token Sent Via: Header

Id: ********-****-****-****-************

Secret: ********-****-****-****-************

Login Style: Redirect

...

Username field: id

Note that the Scope field actually takes a space-separated list of multiple scopes. Furthermore, mapping the username to id seems strange on the surface, but this works since Rocket.Chat under the hood rewrites id to user.userid to match the response from Dataporten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment