How do I make authentication optional for a few en...
# ktor
m
How do I make authentication optional for a few endpoints? E.g. signin API doesn't need authentication, but the other APIs need it (I'm thinking of JWT).
j
• The signin_* *_API doesn't need authentication. So leave the route as it is. • If you want to protect the other route(s) you can encapsulate them using:
Copy code
authenticate {

}
• When authentication is optional (i.e can be used by an authenticated or unauthenticated user) make use of:
Copy code
authenticate(optional = true) {

}
m
Thanks @Jeff 🙂