Hello,<br><br>I want to authenticate a user in twisted.cred by attempting to log him in to an online service. If the authentication step of the connection fails, the user gets no avatar, and if it succeeds, the user gets an avatar, and that avatar either is or has a reference to that connection.<br>

<br>How would I do this? I can think of two ugly ways: I can use a global dictionary mapping avatarIds to protocol instances, and do a lookup on that dict in the Realm to create the avatar. Otherwise, I can instantiate the connection as part of the credentials, and keep the reference to it around when I get the avatar. I&#39;m going ahead with the former, but it&#39;s scary.<br>

<br>Another possibility is that perhaps the credentials checker and the realm could be the same object, and then I could move the global dict into an attribute. Would that be a better approach?<br><br>The background for this is that I have an implementation of the chat 
part of the Direct Connect (DC) protocol, and want to write an IRC&lt;-&gt;DC bridge. I 
chose twisted.words.services on the recommendation of someone, which 
uses Cred for auth. DC has authentication as a given nick as part of the &quot;handshake&quot; during the start of the connection attempt.<br><br>Devin Jeanpierre<br>