OAuth2 module startup fails when I try to run with openmrs platform

Openmrs platform version 2.2.0 SNAPSHOT

Oauth2 module (master): https://github.com/openmrs/openmrs-module-oauth2

Omod loaded: only legacyui-1.5.0-SNAPSHOT.omod

When I upload the .omod it generates this error: https://pastebin.com/gAqcKi4e

And then I can not go back in when I close the session:

HTTP ERROR 4 04 Problem accessing /openmrs/login.jsp. Reason: /openmrs/login.jsp

Can you help me? Thank you @mavrk @dkayiwa

Hi, in the configuration you are using the login page is /localhost/openmrs/login instead of the normal LegacyUI one.

Also, OAuth2 module works in a way that it’s filters needs to be above filters of other modules. So uploading it and then trying to run won’t work. Put the . omod in the modules directory and then start. You’ll see now that OAuth2 module is the first module started by OMRS

Hello @mavrk upload the module as you mentioned and then login with the other login (http://localhost:8080/openmrs/login), the console I throw this: https://pastebin.com/RCeq2Aw6

In the administration section, it does not show the menu options of the oauth module.

Also, it does not let me load another module or create a person:

HTTP ERROR 404 Problem accessing /openmrs/login.jsp. Reason: /openmrs/login.jsp

In the console this:

[Texto preformateadoThu Jun 21 18:38:39 ART 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option is not set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL = false, or set useSSL = true and provide truststore for server certificate verification.

The code you are using is pure-REST based. i.e. All OAuth2 Client management is done RESTfully so essentially the module is completely independent of Legacy UI module.

However, if you want to use UI to manage SMART Apps or see the Administration Section, you can follow up the work we are doing as part of GSoC this year OA-14:Add Controller and required jsp files for running the registered SMART applications by PKatGITHUB · Pull Request #13 · openmrs/openmrs-module-oauth2 · GitHub

Please note : The latest commit is unstable as the student is still working on it and I haven’t merged his changes.

About this, you need to enter your MySQL credentials in webModuleApplicationContext.xml file and re-build the omod and also add “useSSL = false” in your DB connection string.

This Warning is usually thrown when using new versions of mysql-java-connectors.

My goal is to use it only with the FHIR module and to be able to make requests from an external client:

  1. Authenticate me, get an access token with: GET {path} / openmrs / ws / oauth / token

  2. Enter this access token obtained previously in the header (Authorization: Bearer {access_token}) and get some of the web services presented in the FHIR module. For example: GET {path} / ws / rest / patient / {uuid}

How should I do it step by step? What project should I use?

I would like to use this and that does not affect me in the rest of the system functionality.

Yes, you can use it only with the FHIR module if you want to. The master branch from the repo here will serve your purpose.

Also, take a look at https://wiki.openmrs.org/display/projects/OAuth2+Module

This will get you started. Here you’ll find out how to make token requests, create and manage OAuth2 clients, etc.

If you want to see the module in action, look at the collection of videos here