OK thanks for the info. One example where this is a problem is when I run Perforce commands remotely. If the user's ticket doesn't exist or has expired, then it will ask for a password. It can happen at any time since the ticket has a limited lifetime.
The reason I'm not posting code is because I've tried so many different ways to do it now I would not even know what to post at this time. It seems like it would be a relatively common problem so asking how this is usually handled seems like a reasonable thing to do.
The reason I'm not posting code is because I've tried so many different ways to do it now I would not even know what to post at this time. It seems like it would be a relatively common problem so asking how this is usually handled seems like a reasonable thing to do.