Always remember that the Matrix is a visualization only - it's not real. When Smith tortures Morpheus, we see Morpheus sweat but he doesn't sweat on board of his ship. It's just a visualization of him struggling against the attack.
So when they say "codes", that doesn't necessarily mean a pin code. It can mean an idea or an image which Morpheus has to think in his real brain which the "mainframe" (which probably doesn't look like anything we'd recognize) accepts. It could be a blue elephant. In this scenario, Smith tells Morpheus "think of a blue elephant" so his probes can copy the "code" and Morpheus tries to avoid just that.
Maybe the agents try to copy important memories from Morpheus which the mainframe will recognize. That could be a couple of sentences which they told each other or some event they shared.
That said, the "reality" in which Zion "exists" might be just another level of the Matrix. I don't know whether Morpheus is aware of this (in the theory, Neo is but only when the Architect tells him). In this scenario, the access codes are purely virtual as is Zion, the ship, the farm in which Neo wakes up, the devastated surface of the earth, everything - the actors never really wake up.
If you think about it from this angle, then all the information which we have is pretty shaky: If a body can never be removed from the real Matrix, then the connectors could be looking completely different. Maybe Neo and the others are just brains floating in jars.
The more interesting question here is probably: If Morpheus never really left the Matrix, why do the machines have to bother to get the codes from him?
If this is true, the "codes" are just a hoax to keep the humans in Zion occupied.