I completed the first gym in gen 3 to earn the "basic badge" but the badge didn't show up, it still says that I didn't unlock it. I tried redoing it by going to Ayumu in Springdale, but when I click on her nothing happens! And after I completed the gym not only the badge didn't show up but I also got a red alert in chat saying that I won't recieve any trainer EXP until I beat the first gym and BTW, after I beat the gym I got some trainer EXP, tokens and 3 PP up but no badge
Make sure you actually defeated the gym leader (on the top floor of the building that Ayumu is in front of). The quest is not for the badge, it is to unlock the gym.