top of page
Search

Oracle APEX Ords Oauth2 Notes

  • Writer: Personal Chao yu
    Personal Chao yu
  • Oct 7, 2021
  • 1 min read

Updated: Mar 19, 2022



Create Role


BEGIN
  ORDS.create_role(
    p_role_name => 'emp_role'
  );  
  COMMIT;
END;
/

Create Privilege assign role to privilege

BEGIN
  ORDS.create_privilege(
      p_name        => 'emp_priv',
      p_role_name   => 'emp_role',
      p_label       => 'EMP Data',
      p_description => 'Allow access to the EMP data.');
   
  COMMIT;
END;
/

Map privilege to pattern (modules/ parent end point ) defined in apex or with plsql api


BEGIN
  ORDS.create_privilege_mapping(
      p_privilege_name => 'emp_priv',
      p_pattern        => '/employees/*');    
  COMMIT;
END;
/



Create Client and give privilege created earlier

BEGIN
  OAUTH.create_client(
    p_name            => 'emp_client',
    p_grant_type      => 'client_credentials',
    p_owner           => 'My Company Limited',
    p_description     => 'A client for Emp management',
    p_support_email   => 'tim@example.com',
    p_privilege_names => 'emp_priv'
  );
  COMMIT;
END;
/

Grant Role to Client

BEGIN
  OAUTH.grant_client_role(
    p_client_name => 'emp_client',
    p_role_name   => 'emp_role'
  );
  COMMIT;
END;
/

Get Client_Id and Client_secret

SELECT id, name, client_id, client_secret
FROM   user_ords_clients;


Test in Postman

create auth2 authentication

newer version of postman =>







 
 
 

Comments


  • Facebook
  • Twitter
  • LinkedIn

Subscribe Form

©2021 by chaotic. Proudly created with Wix.com

bottom of page