I see that you're calling Getallmessages() and facing the error. Yes the documentation is correct. As you're calling application permission and getting the messages/chat then it comes under protected api's - so you need to submit the request, get approval as discussed in the document. This will help you move forward.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…