Sub Handle(req As ServletRequest, resp As ServletResponse)
Dim bearer As String = req.GetHeader("Bearer") ' to check just a Bearer Header
Dim authheadercomplete As String = req.GetHeader("Authorization") ' check authorizationheader
' and split authheadercomplete to have only the token afterwards...
Check your database now for any valid token and only go on in request if the token is valid.
Dim j As HttpJob
j.Initialize("",Me)
j.Download2("http://192.168.192.121:8888/sendmsg", _
Array As String("title", "the Title", "body", "this is the textbody","topic","general"))
Dim token As String = "This is a dummystr used as a Token"
j.GetRequest.SetHeader("Authorization","Bearer "&token )
Inside the Server handler
B4X:
Dim bearerhdr As String = req.GetHeader("Authorization")
If bearerhdr.Length > 7 Then
Dim token As String = bearerhdr.SubString(7).Trim
Log("Token from Auth-Header: "&token)
End If
Result from serverlog
Token from Auth-Header: This is a dummystr used as a Token