At least, TFA make an effort to give explanation. ''I worked on sanitation'' might be convenient, but it make more sense than RD-D2 having access codes...I hadn't really thought about it in that context before, but watching/ remembering the films, especially the prequels, EVERYTHING just falls into place at the right time to come to the conclusion we see.
We need a ship! Oh there's a ship that's almost done being repaired in the docking bay... I need a lightsaber! Oh...there's one in this box in the basement of this bar that I just happen to be standing in RIGHT NOW, that I got brought to for a completely different reason. I need to get away from these TIE Fighters! Oh...I'm apparently a badass pilot in a ship I've never even flown before IMMEDIATELY after starting it up. I just got my hand chopped off and am about to fall down a pipe into oblivion....good thing my friends who have been in captivity this whole time and fighting to escape just happen to be in a flying ship RIGHT now so they can catch me when I fall. I need to find Yoda on a PLANET I've never been to before and have no idea where he is! Oh...I crashed my ship like 30 feet from his house, cool. We need ot blow up this giant Starkiller base that we don't have plans for! Oh...the stormtrooper who JUST defected and happens to be in this meeting right now just happens to have worked trash detail on that exact station and knows how to blow it up. Jar Jar Binks miraculously lives through all his shenanigans. The list goes ON and ON.