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,â]}â
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.