does jwt auth work with the location api? i do som...
# ktor
b
does jwt auth work with the location api? i do something like routing { somethingWitoutAuth() authenticate("jwt") { routing { somethingWithAuth(); } } }
o
routing
is an extension function to
Application
, which gets or install a
Routing
feature. So inside the second invocation you install routes into root node.
authenticate
installs an interceptor and it’s lambda has
Route
as a receiver. Remove inner
routing
call to make it work.
b
somethingWithAuth is an extension function of Routing so i can't use it directly in the authenticate block
i can do
authenticate("jwt") { this@routing.createPlayer(database) }
the reference the outter routing but this doesnt work
o
Make it extension on
Route
instead, so it is a proper routing builder function
b
is it recommended to use Route extension functions instead of Routing?
o
Yes, all building functions should be on
Route
.
Routing
is-a route, so it will work on top level too.