Join Slack
Is there a way to have a route with optional authentication? I have a specific route that both users...
# ktor
c
CLOVIS
07/14/2022, 3:21 PM
Is there a way to have a route with optional authentication? I have a specific route that both users and anonymous clients can access.
e
Eric Grimsborn
07/14/2022, 4:26 PM
Maybe a bad idea but, you could create an auth provider that always succeeds authenticating and add that to the route since the
authenticate
function can be called with multiple configurations.
Eric Grimsborn
07/14/2022, 4:27 PM
They actually have functionality for this…
Eric Grimsborn
07/14/2022, 4:28 PM
Just add the parameter for
optional
Eric Grimsborn
07/14/2022, 4:29 PM
It will give you a
null
principal according to the documentation.
c
CLOVIS
07/14/2022, 5:38 PM
I have to give it to them that in insight it was extremely easy to find.
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by