Again very difficult to answer with those snippets (no idea what messaging.RunMethod("getToken") does). My
guess would be that the getToken() method should be called getToken
Wait() because it has to be called async (it, or its called methods, use await functions, which include promises and fetches).
I'm aware this concept of promise/async/await is not easy to understand, as such a thing is typical JavaScript and does not really exist in B4J. That is why I avoided to go deeper into it here and just said if you make a call to a method that has to 'wait' for an answer, just add 'Wait' as a postfix to that methods name.
I see if I can make the transpiler smarter so you do not need to be aware of that anymore and it will make it async automatically if it detects await calls. The trick will be not to break existing code... ?
If you still are interested in the underlying JavaScript concept, this is a good read:
https://javascript.info/async-await
Alwaysbusy