-
Notifications
You must be signed in to change notification settings - Fork 42
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
Basic Auth with Router #155
Comments
Did you already try adding |
I'm not sure did I understand you correctly. If you want to have the whole app including the router protected by the auth middleware just mount the |
Yes, I am trying to make authentication available for all calls in the application but when the auth() function is executed it always returns a 401 code because the Authorization header is not obtained correctly. What could be the problem?: void auth(Request &req, Response &res) { |
Sorry, I solved this problem with this: app.header("Authorization", authBuffer, 200); but I have another problem as I have all the functions I mentioned above defined in my API (15 functions): router.get("/ip/:ip", &change_ip_arduino); app.header("Authorization", authBuffer, 200); app.use("/box", &router); and when I launch this code on my Arduino, the API does not receive the calls. But when I comment a few calls defined in Router (7 functions) and leave the other functions active (8), the API calls are received correctly. Could it be that there is a limitation in the library with the number of calls that can be defined? As additional information, the program storage space is as follows: |
There is no such limitation on the library. Sounds like you are running out of memory. The SRAM usage can't be predicted at compile time. See https://learn.adafruit.com/memories-of-an-arduino/measuring-free-memory#sram-370031. |
Hi,
I have these methods defined from Router and assigning that Router to Application.
router.get("/ip/:ip", &change_ip_arduino);
router.get("/id", &get_id_arduino);
router.get("/semaphore/:rgbId/:time", &on_semaphore);
router.get("/offsemaphore", &off_semaphore);
router.get("/beat/:rgbId/:ncodes", &beat);
router.get("/spiral/:type/:rgbId/:ncodes", &spiral);
router.get("/alarm/:time", &on_alarm);
router.get("/offalarm", &off_alarm);
router.get("/shortlongalarm/:alarmtype/:ncodes", &short_long_alarm);
router.get("/combined/:semaphoretype/:rgbId/:time/:ncodes", &combined);
router.get("/relay/:type/:relayId", &on_off_relay);
router.get("/watchdog/:time", &watchdog);
router.get("/dhcp/:type", &add_dhcp);
router.get("/dhcp", &dhcpState);
router.get("/reset", &resetIP);
app.use("/box", &router);
And I am trying to be able to verify authentication with Router and Application instead of Application only as in this example: https://github.com/lasselukkari/aWOT/blob/master/examples/AuthMiddleware/AuthMiddleware.ino
How could I perform this authentication?
The text was updated successfully, but these errors were encountered: