Attention: The EBRAINS IDM/IAM will be down tomorrow, Wednesday 17nd December, from 17:00 CET for up to 30 minutes for maintenance. Please be aware that this will affect all services that require login or authentication.


Use your OIDC client as service account

Version 3.1 by messines on 2020/12/04 11:46

Abstract

With IAM, you have the possibility to log in useing your client_id and your secret to generate an access token.

This can be partiuculary usefull in a tier application, you can use your_client to log in into your app but also then to reach our Drive and Collab API.

Configure your OIDC Client

First thing to do is to configure your OIDC client as a Service account. You juste have to provide "serviceAccountsEnabled" : true in the définition of your client. Please have a look to this documentation know how to modify your oidc client.

{
  "defaultClientScopes" : [
     "web-origins",
     "roles"
   ],
  "redirectUris" : [
     "/relative/redirect/path",
     "/these/can/use/wildcards/*"
   ],
  ...,

  ...,
  "serviceAccountsEnabled" : true
}

Generate an Access token using client credentials

Endpoint :

https://iam.ebrains.eu/auth/realms/hbp/protocol/openid-connect/token

Params :

Request Body
grant_type: "client_credentials"
client_id: "clientId"
client_secret: "clientSecret"
scope: "The scopes you need and which are available in your client"


# Send the get access token request
curl -X POST https://iam.ebrains.eu/auth/realms/hbp/protocol/openid-connect/token \
 -H 'Content-Type: application/x-www-form-urlencoded' \
 -d "grant_type=client_credentials&client_id=myclient&client_secret=mysecret&scope=email%20profile%20team%20group%20clb.wiki.read%20clb.wiki.write"