wooden-manchester-52124
04/04/2024, 4:41 AMmagnificent-energy-493
wooden-manchester-52124
04/04/2024, 5:43 PMDid you see the OAuth2 webhooks?Yes but the webhook request requires a specific payload with session and id token details. I only have access token for m2m clients, is there a way to construct webhook payload with access token?
you need some additional custom code on top to make this workI think this is what we do with Auth0 Actions, we define custom code in the actions itself to inject custom claims. Ory Actions dont seem to support creating actions for client credential grants. And the webhook option seems unusable as well as it needs id token in request payload. So how do you suggest I add custom code in Ory?
magnificent-energy-493
miniature-morning-2235
04/10/2024, 1:25 PMwooden-manchester-52124
04/10/2024, 2:24 PMminiature-morning-2235
04/10/2024, 3:06 PMmagnificent-energy-493
Just tried this out, works as documented:
Copy codeeyJhbGciOiJSUzI1NiIsImtpZCI6ImZjNmY4YmRhLWU2OTYtNDYwNi1iZDJlLWNiZDFiMmVmNGUwYSIsInR5cCI6IkpXVCJ9.eyJhdWQiOltdLCJjbGllbnRfaWQiOiJjOWUyNzBhMi02M2MzLTRjMzctODlhZS1kYTYyOTRjYmEzMzEiLCJleHAiOjE3MTI4NTQwNDcsImV4dCI6eyJmb28iOiJiYXIifSwiaWF0IjoxNzEyODUwNDQ3LCJpc3MiOiJodHRwczovL2ZvY3VzZWQtZ2Fsb2lzLWVueGIxdXpxazkucHJvamVjdHMub3J5YXBpcy5jb20iLCJqdGkiOiIwY2Y2OGZlMi05OTlkLTQ2Y2MtOGQ2Yy03MDUyNDBkMjFhZGMiLCJuYmYiOjE3MTI4NTA0NDcsInNjcCI6W10sInN1YiI6ImM5ZTI3MGEyLTYzYzMtNGMzNy04OWFlLWRhNjI5NGNiYTMzMSJ9.Kfugf4OMEuKWPCLVE4mIkpmljqf-NeuWY5-yFH5hCMhiu4FP227ZWbz2Mtb5uvM3p4mJPAdUsERHMqgMZLBLDLIFETSfW9ZfjoBfvRNlu-j3txCDv4uR6ivzhVHEZK3MuIOtGDGObh6eKTSJhDHIKYzm5cvCRSkgROZbo5lt7yy7gPBMt2EG3mrmd8qxq1wBZZcfAA7jyn41ULj3jrY8jQPjjcL5l0_i3pXeYW1tMTIPLOsvOi4pxUROBOhFzYML9idrq9UcZmUifoYsxQ_cGCIeO32badyFI-ON3f6WRDSlydaQfRoBb9vBLYPgWeSqJp4awiU8k-DW4KpuUTriSq4PjqVrYCzYqTEvWD3m-A-3BkYdFvA2QZ4tWT0l9fNjhl4E9Y4nJ9HJaAwVwD7j9tuPKk82dMqYjOYiRr14zDdKlMyxoGTSYOmuyB2bh3P-xL3pYJfw0MmajENTj7ibbUJpafBJDwShYZAtPPCMIikKPhe7S8SLp4N33bIhoq0pfpna6YX2QRitRRUelkmasgdmkUVeM6emBX-cjJWJbpN6jTMvnoLQqqtVZ-l4mKI0zNn-Ls1eiV5RS8vMlI8VbcNSXQyc2wVD7DsaqbZ8GHRviRoeoOIFNuC5TWjIQirpGfq6Jlm_GI3HNVPc-z6fDQ9IYioHQlzveWH0YsCWCZI
```{
"aud": [],
"client_id": "c9e270a2-63c3-4c37-89ae-da6294cba331",
"exp": 1712854047,
"ext": {
"foo": "bar"
},
"iat": 1712850447,
"iss": "https://focused-galois-enxb1uzqk9.projects.oryapis.com",
"jti": "0cf68fe2-999d-46cc-8d6c-705240d21adc",
"nbf": 1712850447,
"scp": [],
"sub": "c9e270a2-63c3-4c37-89ae-da6294cba331"
}```
```ory patch oauth2-config $project_id \
--add '/oauth2/token_hook/url="https://YOUR-WEBHOOK-ENDPOINT"' \
--add '/oauth2/token_hook/auth/type="api_key"' \
--add '/oauth2/token_hook/auth/config/in="header"'\# or cookie
--add '/oauth2/token_hook/auth/config/name="X-API-Key"' \
--add '/oauth2/token_hook/auth/config/value="MY API KEY"' \
--format yaml```
must return such a payload:<https://your-webhook-endpoint>
```{
"session": {
"access_token": {
"foo": "bar"
}
}
}```
magnificent-energy-493
miniature-morning-2235
04/12/2024, 12:24 PM