Posted by @harshp1509:
how can we use rmf web api outside of rmf-web ?
when i am trying to see the task list using api (localhost:port/tasks) than it’s giving me not authorize.
Chosen answer
Answer chosen by @harshp1509 at 2024-11-20T06:58:48Z.
Answered by @aaronchongth:
hello @harshp1509! I’m not sure how you’re currently setting up your rmf-web
stack, if you’re using the demos that we have, take a look at rmf-web/packages/rmf-dashboard-framework/src/services/stub-authenticator.ts at main · open-rmf/rmf-web · GitHub and rmf-web/packages/api-server/api_server/default_config.py at main · open-rmf/rmf-web · GitHub
For our demos we are using a hardcoded secret, which produces these hardcoded tokens, and can be used for access outside of rmf-web
.
curl -H 'Accept: application/json' -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzdHViIiwicHJlZmVycmVkX3VzZXJuYW1lIjoidXNlciIsImlhdCI6MTUxNjIzOTAyMiwiYXVkIjoicm1mX2FwaV9zZXJ2ZXIiLCJpc3MiOiJzdHViIiwiZXhwIjoyMDUxMjIyNDAwfQ.vK3n4FbshCykQ9BW49w_7AfqKgbN9j2R3-Qh-rIOt_g" http://localhost:8000/tasks
If you’re setting up a full deployment stack, you’ll need to use an authentication tool like keycloak
to allow proper authentication and tokens, you can check out GitHub - open-rmf/rmf_deployment_template: This repo provides a template to deploy RMF for that