Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

OAUTH2 grant_type=client_credentials --> "error":"invalid_request"

JeremxOct 1 2019 — edited Oct 3 2019

Hello,

Can you help me on the following error message? (ORDS19.2 + tomcat 7) certificat SSL ok

Can not find a solution ...

[root@ords logs]# curl -i -k --user ogDa_C1DmE5JhjoVL4Oi_g..:AQ3rsFXlPWPTocgzf-eDng.. --data "grant_type=client_credentials" https://***:8443/ords/ophetud/oph/oauth2/token

HTTP/1.1 400 Mauvaise Requ�te

Server: Apache-Coyote/1.1

Content-Type: application/json

Transfer-Encoding: chunked

Date: Tue, 01 Oct 2019 13:47:29 GMT

Connection: close


{"error":"invalid_request","error_description":"L'une des valeurs de paramètre de demande suivantes est manquante ou incorrecte : grant_type"}

Here is the SQL command :

BEGIN

  ORDS.enable_schema(

    p_enabled             => TRUE,

    p_schema              => 'OPH',

    p_url_mapping_type    => 'BASE_PATH',

    p_url_mapping_pattern => 'oph',

    p_auto_rest_auth      => FALSE

  );

   

  COMMIT;

END;

BEGIN

    ORDS.ENABLE_OBJECT(p_enabled => TRUE,

                       p_schema => 'OPH',

                       p_object => 'V_PATRI',

                       p_object_type => 'VIEW',

                       p_object_alias => 'v_patri',

                       p_auto_rest_auth => FALSE);

   

    commit;

END;

----

BEGIN

  OAUTH.create_client(

    p_name            => 'Docuware_Client',

    p_grant_type      => 'client_credentials',

    p_owner           => 'Docuware',

    p_description     => 'GED',

    p_support_email   =>' rfr',

    p_privilege_names => 'null'

  );

  COMMIT;

END;

/

SELECT id, name, client_id, client_secret

FROM   user_ords_clients;

---------- create role

BEGIN

  ORDS.create_role(

    p_role_name => 'acces-ged-role'

  );

 

  COMMIT;

END;

/

---------- create privilege + mapping sur role

DECLARE

  l_arr OWA.vc_arr;

BEGIN

  l_arr(1) := 'acces-ged-role';

 

  ORDS.define_privilege (

    p_privilege_name => 'acces-ged-priv',

    p_roles          => l_arr,

    p_label          => 'Privilege GED',

    p_description    => 'Privilege mapping pour GED'

  );

  

  COMMIT;

END;

/

------Si plusieurs object ajout de plusieur mappping....

BEGIN

  ORDS.create_privilege_mapping(

    p_privilege_name => 'acces-ged-priv',

    p_pattern => '/v_patri/*'

  );    

  COMMIT;

END;

/

---------- grant role à l'user

BEGIN

  OAUTH.grant_client_role(

    p_client_name => 'Docuware_Client',

    p_role_name   => 'acces-ged-role'

  );

  COMMIT;

END;

/

BEGIN

  OAUTH.grant_client_role(

    p_client_name => 'Docuware_Client',

    p_role_name   => 'acces-ged-role'

  );

  COMMIT;

END;

/

This post has been answered by Jeremx on Oct 3 2019
Jump to Answer
Comments
Post Details
Added on Oct 1 2019
1 comment
619 views