Wiki source code of Adding a service account to a Collab Team or a Group
Last modified by chaney08 on 2023/04/28 14:55
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | == Abstract == | ||
| 2 | |||
| 3 | In some case, you maybe want your service account beeing member of a team or a group (to access APIs of theses team/group with your service account token). | ||
| 4 | \\This is not possible through the front-end, service account doesn't appears. But you can do it using the API. | ||
| 5 | |||
| 6 | == Requirement == | ||
| 7 | |||
| 8 | You need first to create an OIDC client and enable the service account for this client and fetch an access token for this account. | ||
| 9 | \\1 - [[Create your OIDC Client>>doc:Collabs.the-collaboratory.Documentation IAM.FAQ.OIDC Clients explained.1\. Registering an OIDC client v2.WebHome]] | ||
| 10 | |||
| 11 | 2 - [[Enable the service account and get a token>>doc:Collabs.the-collaboratory.Documentation IAM.FAQ.OIDC Clients explained.Using your OIDC client as a service account.WebHome]] | ||
| 12 | |||
| 13 | |||
| 14 | {{warning}} | ||
| 15 | Getting once an Access Token using the client_credentials flow is necessary to generate the service-account user in our system. If you don't do this step, you will encounter a 404 User Not Found while adding your service account to a team or a group. | ||
| 16 | {{/warning}} | ||
| 17 | |||
| 18 | |||
| 19 | == How to == | ||
| 20 | |||
| 21 | Finally, your just have to refer to the [[Collab API>>https://wiki.ebrains.eu/bin/view/Collabs/the-collaboratory/Documentation%20Wiki/API/]] section Team or Group and use the PUT request to add a user to a team/group | ||
| 22 | \\The only thing to know is that the **username **value for service account is the prefix **service-account- **followed by the clientId of your oidc client. | ||
| 23 | \\Now if you fetch an access token for your service account using scopes team and group, you will see that your service account is member of theses teams/groups and you will be able to use your service account to interact with your collab or you groups through a notebook or any scripts. | ||
| 24 | \\[[image:Screenshot 2022-10-19 at 15.00.51.png||height="401" width="462"]] | ||
| 25 | |||
| 26 |