For everyone saying that Riku deserved it more so because he save Sora from the darkness, I will say that Sora once helped Riku out when he was possessed by Ansem, because, you know, he beat Ansem. Granted, Riku did the rest, but he would have never had the chance to fight the darkness in his heart if it wasn't for Sora. However, Riku learned and matured from that experience, and since Sora never really had to struggle when returning from darkness the first time after becoming a heartless, he didn't really have much to learn from. Sora may have saved the world on a few occassions(though, let's be honest, Organization XIII in KHII wasn't exactly destroying worlds), he still lacked the true maturity that came with being a keyblade master.