Kelly,
Thank you so much, this has worked perfectly for me.
I load my layers, and if it hits a secure layer it prompts excellently. My only problem is i do something after the layers load, and since it is all asynchronous, the delay of logging in is making me miss my event.
I do it onLayerAdd, it doesn't seem that this event is being fired after a layer is loaded that includes a challenge from the identity manager.
Is there an onSuccessLogin type event that i can listen for to trigger my refresh (its for a TOC legend).