Untitled

mail@pastecode.io avatar
unknown
kotlin
2 years ago
921 B
2
Indexable
Never
        //https://jwt.io/ adresinden token  check debilirsin
        val USER_LOGIN_TOKEN_OLD = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NzM5ODUzMDAsImV4cCI6MTY3Mzk4ODkwMCwidWlkIjoxMywidXNlcm5hbWUiOiJjaWhhbmNhbGxpIiwiZW1haWwiOiJjaWhhbi5jYWxsaWlAZ21haWwuY29tIn0.YC7Y0IGQxameYBvplUTLF7O5QLUuQLEwZYXbkXyvEGU"
        val jwt = JWT(USER_LOGIN_TOKEN_OLD)
        val header = jwt.header
        val signature = jwt.signature
        val username = jwt.getClaim("username").asString()
        val email = jwt.getClaim("email").asString()
        val uid = jwt.getClaim("uid").asString()
        val isExpired = jwt.isExpired(10) // Do time validation with 10 seconds leeway

        println("header: $${header}")
        println("isExpired: $isExpired")
        println("signature: ${signature}")
        println("username: ${username}")
        println("email: ${email}")
        println("uid: ${uid}")