I really appreciate your help Oliver.
Let me add a few more details:
1. The B4J app is a server app implementing REST services. In addition to the Server Handler above there are many other handlers associated with multiple AddHandler definitions in the Main code:
Sub AppStart (Args() As String)
Private srvr As Server
srvr.Initialize("srvr")
srvr.AddHandler("/authorization/login", "login", False)
srvr.AddHandler("/authorization/register", "register", False)
End Sub
2. The DB includes the Auth table, with sessionID and LoginHint fields among others.
3. The "login" handler class contains the code I shared before, and it works fine as in your case.
The "register" handler class instead contains the following code:
Sub Handle(req As ServletRequest, resp As ServletResponse)
Dim parser As JSONParser
parser.Initialize(json)
Dim root As Map = parser.NextObject
Dim login_hint As String = root.Get("login_hint")
Log ("login_hint: " & login_hint)
Dim cursor As ResultSet
cursor = Main.sqlObj.ExecQuery($"SELECT * FROM NDIAuth WHERE AuthReqID="${auth_req_id}""$)
sqlObj.ExecNonQuery($"UPDATE Auth SET LoginHint="${login_hint}" WHERE sessionID="${sessionID}""$)
resp.Write("")
End Sub
4. If I run the server and call the /authorization/register endpoint I can update the DB and write the LoginHint value, that is initially empty.
If I call the /authorization/login endpoint the code in AuthCallback should loop until the "register" handler writes a value in the LoginHint field of the sessionID record.
Instead, when AuthCallback is looping the "register" Handler becomes unresponsive, so if the user calls the /authorization/register the server does not respond and therefore LoginHint would never be updated and therefore the AuthCallback loop would never exit.
Hope this helps... Thanks again