Hi,
I would like to know if you have a CLI command to update a callback URL for an application in Auth0. When i spin up an application, I wanted to automatically add the url of the environment to callback URL. Is it possible?
regards,
Suguna
Hi @srajendran,
Yes, this is possible.
Using the Auth0 CLI, you can call the auth0 apps update <app_id> --callbacks https://yourApp/callback command to update your callback URL.
Reference: auth0 apps update | Auth0 CLI
Please let me know if you have any questions.
Thanks,
Rueben
Hi,
Sorry,Can this be done using API call?
And I would like to know if the values can be appended to the callback URl through API call.
Hi @srajendran,
You can use the Management API to update the Callback URL.
The CLI command would be:
curl -L -X PATCH 'https://YOUR_DOMAIN.REGION.auth0.com/api/v2/clients/:id' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}' \
-d '{"callbacks":["string"]}'
Reference: Auth0 Management API v2
Thanks,
Rueben
curl -L -X GET ‘https://YOUR_DOMAIN.REGION.auth0.com/api/v2/clients/:id’
-H ‘Content-Type: application/json’
-H ‘Accept: application/json’
-H ‘Authorization: Bearer {access_token}’
-d’{“client_secret”:“SECRET”}’
Can we use the above CLI command to Get the the Callback URLs of the client?
Hi @srajendran,
Have you given it a try?
You should call the Management API’s Get a client endpoint and include the callbacks as a query field if you need to get the callback URL of your application.
curl -L 'https://onboarding-tiow.us.auth0.com/api/v2/clients/:id?fields=callbacks' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer auth0_token'
Thanks,
Rueben
Sorry Ruben,
When i try to update using CURL command
curl -L -X PATCH ‘https://foodlogiq-dev.auth0.com/api/v2/clients/Y4Q6mxAaTvh4LV3trEej54WoHrIsosJo’ \
-H ‘Accept: application/json’ \
-H ‘Authorization: Bearer token’ \
-d ‘{“callbacks”:[“https://pii-2239-env.foodlogiq.io/v3/auth/callback/https:%2F%2Fpi-2239-env.foodlogiq.com%2Fauth%2Fcallback%3Fnext=%2F,”]}’
I get the error below:
{“statusCode”:400,“error”:“Bad Request”,“message”:“Payload validation error: ‘Additional properties not allowed: {"callbacks":["https://pii-2239-env.foodlogiq.io/v3/auth/callback/https://pi-2239-env.foodlogiq.com/auth/callback?next’.”,“errorCode”:“invalid_body”}%
What am i doing wrong?
Hi,
i got this sorted. Should i use Authorization:Bearer or client secret to update Callback URL?
when i use on;ly client secret, it says missing authentication.Should i use AUthorization bearer and client id or both?
curl -L -X PATCH ‘https://foodlogiq-dev.auth0.com/api/v2/clients/Y4Q6mxAaTvh4LV3trEej54WoHrIsosJo’ \
-H ‘Content-Type: application/json’ \
-H ‘Accept: application/json’ \
-d’{“client_secret”:“secret”,“callbacks”:[“https://pii-2239-env.foodlogiq.io/v3/auth/callback/https:%2F%2Fpi-2239-env.foodlogiq.com%2Fauth%2Fcallback%3Fnext=%2F,”]}’