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

Sergio Casero

07/04/2019, 4:01 PM
Hi everyone! I've have just a (maybe noob) question. I'm implementing Oauth2 by using this guide -> https://ktor.io/quickstart/guides/oauth.html and looks like everything is working fine, I can see the token but... the question is, how can I indicate that requests need the auth? Right now my config is something like this:
Copy code
routing {
        authenticate(OauthConfig.NAME) {
            route("/test") {
                get { call.respond("Sample from auth part...") }
            }
        }
    }
When I call this WS, I set the access token into the auth header (Bearer) with postman but I get 401, if I do the request from browser, I always get a redirection to the login and it generates new token 😞
c

cy

07/04/2019, 6:04 PM
s

Sergio Casero

07/04/2019, 6:27 PM
I have sessions implemented and looks like they works, but... Should I remove the "authenticate" block on the requests??
Also, I don't know how to manage token expiration with that... I'll take a look
5 Views