I'm trying to understand how ejabberd_oauth.erl implementing the oauth. Inside the ejabberd_oauth.erl, there is a function name associate_access_token - this is where mnesia:dirty_write(R) located. Based on my understanding, mnesia:dirty_write(R) should write the record into the DB but I totally wrong after completed the test.
Test : I've commented the whole function and run the oauth, then dump_table to check the latest DB content. The DB that I just dumped still contain the latest token. This is means that the write-into-the-db is controlled by another function.
Note : I even rename (make typo) mnesia:dirty_write(R) to be something like mnesia:dirtysz_write(R). My test proved that associate_access_token don't even detect / check the syntax error of mnesia:dirty_write(R).
Please advice.
Thanks!
I can think two
I can think two possibilities:
A) That function is not used, or is not responsible for the writting you are investigating.
B) Your are editing the source code, but you later don't run that code. Remember to compile, copy the resulting beam file (or install) to the proper place, and restart ejabberd.
I suspect you suffer problem B. To check what is going on, add those two logging lines. They will tell you if the module that you modify is really used by ejabberd, and also if the function is used when writting information: