Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start the sample service. #68

Open
AdityaKBhadragond14 opened this issue Aug 25, 2023 · 3 comments
Open

Unable to start the sample service. #68

AdityaKBhadragond14 opened this issue Aug 25, 2023 · 3 comments

Comments

@AdityaKBhadragond14
Copy link

Hi, I am trying to setup the development environment for the reference data and I am able to run the service but when I try to hit the route to get the API I get the error saying "Full authentication required to access these service" with "unauthorized 401" code. Please help me out with this issue. Thank You.

@anawrotsoldevelo
Copy link
Contributor

Hello!
You need to start referencedata together with ref-distro.

  1. Clone ref-distro and referencedata:
    https://github.com/OpenLMIS/openlmis-ref-distro
    https://github.com/OpenLMIS/openlmis-referencedata

  2. Download an .env from here https://github.com/OpenLMIS/openlmis-ref-distro/blob/master/settings-sample.env

  3. Place it in both repositories (in referencedata it should be called .env, in ref-distro settings.env, replace BASE_URL and VIRTUAL_HOST variables with your own IP address.

  4. Change used docker image version in ref-distro to your local one (https://github.com/OpenLMIS/openlmis-ref-distro/blob/master/.env):
    OL_REFERENCEDATA_VERSION=latest

  5. Build new local docker image in referencedata repository:
    docker-compose -f docker-compose.builder.yml run builder
    You can skip Transifex token by clicking enter
    docker-compose -f docker-compose.builder.yml build image

  6. Run ref-distro:
    docker-compose up

  7. You can access the webpage by your IP address

This should allow you to access the page, please tell me if it worked for you.

@AdityaKBhadragond14
Copy link
Author

Hi, there are some copy commands in the DockerFile:
COPY /schema build/schema,
COPY build/libs/*.jar /service.jar

but the files to be copied do not exist in the directory. Can these commands be ignored?

@AdityaKBhadragond14
Copy link
Author

AdityaKBhadragond14 commented Aug 28, 2023

Okay so I was able to setup and run but now I get this error:

Invalid token does not contain resource id (referencedata) access_denied

when I try to hit this url:
http://10.102.10.153:8080/api?access_token=7eaa2d29-44ad-4443-991b-46423c75d36d

I am using the generated OpenLMIS token using postman.

For reference this is the environment for getting the access token:

Request url:

http://localhost/api/oauth/token?grant_type=password&username=administrator&password=password

Authorization:
Basic dXNlci1jbGllbnQ6Y2hhbmdlbWU=

Response:

{
"access_token": "7eaa2d29-44ad-4443-991b-46423c75d36d",
"token_type": "bearer",
"expires_in": 1739,
"scope": "read write",
"referenceDataUserId": "a337ec45-31a0-4f2b-9b2e-a105c4b669bb",
"username": "administrator"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants