I'm building a teams bot and in it I have an OAuthPrompt to gather credentials for an external service. After initially logging in, I would like to display a "You are now logged in" message. The problem I have is determining if the login is the initial login (or a token refresh which I have to handle manually since the service doesn't provide token life or refresh abilities) or if it is gathering an existing token. I was checking for the activity "invoke" which worked initial, but as my bot gets more complicated, this method is no longer working.
I have a waterfall dialog the follows the flow:
GetServiceTokenStep
(calls GetServiceTokenDialog
) ->
DoSomethingWithTokenStep
In DoSomethingWithTokenStep, one of my actions redirects to another dialog VerifyRequestDialog
. In that dialog, I call GetServiceTokenDialog
again to retrieve the token I got earlier (or get a new one if needed). The problem is if they had to get the token in GetServiceTokenStep
, then when it reaches VerifyRequestDialog
then the activity is still "invoke" so it shows the "Hello" message again, even though is already has the token.
What can I check to see if the OAuthPrompt returned an existing token or got one from a new login?