I have barely started scala and trying to write small project. I wrote server which consumes graphql requests. For now I have a problem with jwt tokens, because method used for validation returns Directive1[ByteString] instead of ByteString. Can I retrieve it somehow? I need claim data from that jwt token after validation
Here is the code that I'm struggling with:
val directive: Directive1[ByteString] = jwt.jwtAuthenticate(Unmarshaller._fromStringUnmarshallerFromByteStringUnmarshaller)
val claim: String = ???
As described in Akka Http Dirrective docs - directive is building block of route. So you need to handle route, something like:
val claim: String = dirrective { claim: String => // your token string
complete((StatusCodes.Ok, "Handled")) // give HTTP response
}