https://kotlinlang.org logo
#ktor
Title
# ktor
m

manlan

09/03/2020, 4:05 AM
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

Jeff

09/03/2020, 7:54 AM
• 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

manlan

09/03/2020, 5:27 PM
Thanks @Jeff 🙂