Commit 8e84fc13 authored by Cédric OLIVIER's avatar Cédric OLIVIER Committed by Girija Saint Ange
Browse files

doc(authentication): code excerpt to retrieve token secret

parent d4ea9094
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -95,7 +95,10 @@ Follow these steps:
```bash
oc create serviceaccount cicd
oc policy add-role-to-user <role_name> system:serviceaccount:<your_project_name>:cicd -n <your_project_name>
oc serviceaccounts get-token cicd
# below command displays `serviceaccount-token-name` (ex: cicd-token-l9tdx)
oc get secrets --field-selector type=kubernetes.io/service-account-token -n <your_project_name> | grep cicd | head -1 | cut -d " " -f 1
# use this `serviceaccount-token-name` to get secret with jq
oc get secret <serviceaccount-token-name> -o json -n <your_project_name> | jq -r .data.token | base64 -d
```

:warning: don't forget to replace `<your_project_name>` with your OpenShift project name and `<role_name>` with the appropriate role (ask your OpenShift support).