File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 5757 echo "$json_array" > files_payload.json
5858 echo "JSON_PAYLOAD_PATH=files_payload.json" >> $GITHUB_ENV
5959
60+ - name : 🔐 Authenticate via OIDC and get access token
61+ id : get_token
62+ run : |
63+ echo "Requesting OIDC token..."
64+ export ID_TOKEN=$(curl -s -X POST -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
65+ -H "Content-Type: application/json" \
66+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ env.CLIENT_ID }}" | jq -r '.value')
67+
68+ echo "Exchanging OIDC token for access token..."
69+ access_token=$(curl -s -X POST https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token \
70+ -d "client_id=${{ env.CLIENT_ID }}" \
71+ -d "grant_type=client_credentials" \
72+ -d "scope=api://${{ env.CLIENT_ID }}/.default" \
73+ -d "client_assertion=$ID_TOKEN" \
74+ -d "client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer" \
75+ | jq -r '.access_token')
76+
77+ echo "TOKEN=$access_token" >> $GITHUB_ENV
6078
6179
6280 # 3. Send a simple GET request to "/"
You can’t perform that action at this time.
0 commit comments