gaetan
12/06/2018, 7:52 AMgaetan
12/06/2018, 10:38 AM/login
call. Your example has this code:
authenticate("google-oauth") {
route("/login") {
handle {
val principal = call.authentication.principal<OAuthAccessTokenResponse.OAuth2>()
?: error("No principal")
It’s difficult to understand what is happening by reading the code:
1. /login
is called by a redirect from the OAuth provider after the user validation on provider website (4),
2. but handled on our behalf by ktor authentication, to retrieve the token (4.1),
3. before giving us the possibility of making a call to the provider(4.2).