
Hi; I am reading the REST API Guide, it's the first time that I am testing this. I have hard time to use OAuth authentication to make queries. I can get the token with curl and with a firefox REST module *curl --cacert ca.crt -X POST -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json' -d 'grant_type=password&scope=ovirt-appapi&username=admin%40internal&password=mypass' https://engine101.example.com/ovirt-engine/sso/oauth/token <https://engine101.example.com/ovirt-engine/sso/oauth/token> HTTP/1.1* engine log : [org.ovirt.engine.core.sso.utils.AuthenticationUtils] (default task-1) [] User admin@internal successfully logged in with scopes: ovirt-appapi But when I try to use it I get this error : *curl --cacert ca.crt -X GET -H 'application/xml' -H 'Authorization: Bearer fT0knxah-wEOyi-VdhmozKv-hz-wohVm268BBJts-MYxNZ548K0UZCSmv5nY18Z6gPiFdl-VAySjqr_N4gPGAA' https://engine101.example.com/ovirt-engine/api/vms <https://engine101.example.com/ovirt-engine/api/vms> HTTP/1.1* engine log: ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default task-30) [] Cannot authenticate using authentication Headers: The required scope ovirt-app-api is not granted. With basic authentication, it's working, so I don't know where is the problem. Regards. <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Garanti sans virus. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#m_8952078234548713351_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Fri, Aug 18, 2017 at 11:38 PM, wodel youchi <wodel.youchi@gmail.com> wrote:
Hi;
I am reading the REST API Guide, it's the first time that I am testing this.
I have hard time to use OAuth authentication to make queries.
I can get the token with curl and with a firefox REST module curl --cacert ca.crt -X POST -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json' -d 'grant_type=password&scope=ovirt-appapi&username=admin%40internal&password=mypass' https://engine101.example.com/ovirt-engine/sso/oauth/token HTTP/1.1
You have incorrect scope. You have ovirt-appapi , but it should be ovirt-app-api
engine log : [org.ovirt.engine.core.sso.utils.AuthenticationUtils] (default task-1) [] User admin@internal successfully logged in with scopes: ovirt-appapi
But when I try to use it I get this error : curl --cacert ca.crt -X GET -H 'application/xml' -H 'Authorization: Bearer fT0knxah-wEOyi-VdhmozKv-hz-wohVm268BBJts-MYxNZ548K0UZCSmv5nY18Z6gPiFdl-VAySjqr_N4gPGAA' https://engine101.example.com/ovirt-engine/api/vms HTTP/1.1
engine log: ERROR [org.ovirt.engine.core.aaa.filters.SsoRestApiAuthFilter] (default task-30) [] Cannot authenticate using authentication Headers: The required scope ovirt-app-api is not granted.
With basic authentication, it's working, so I don't know where is the problem.
Regards.
Garanti sans virus. www.avast.com
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (2)
-
Ondra Machacek
-
wodel youchi