The usernames and passwords need to be synced between the PC and the PC with the share.
If you have john1:superdupersecurepassword on one computer, you need to have john1:superdupersecurepassword on the machine with the share you're trying to access. If the passwords or usernames are different, you'll be asked for a username and password when the share is accessed.
The "login with different credentials" option is displayed at the bottom of the Map network drive window when the drive is initially mapped.
Alternately you could use the command below if you're using a script.
net use X: \\workstation\share PASSWORD /user:WORKSTATION\username /savecred /persistent:yes