[ovirt-users] testing REST API

Ondra Machacek omachace at redhat.com
Sat Aug 19 06:47:04 UTC 2017


On Fri, Aug 18, 2017 at 11:38 PM, wodel youchi <wodel.youchi at 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 at 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 at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>


More information about the Users mailing list