Skip to content

Commit 68699f0

Browse files
Setting flow state to COMPLETE when retrieving cached token (#112)
* Fixed reference to Activity.add_ai_metadata * Setting flow state to complete on get_token
1 parent 6920227 commit 68699f0

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/oauth/oauth_flow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ async def get_user_token(self, magic_code: str = None) -> TokenResponse:
140140
self._flow_state.expiration = (
141141
datetime.now().timestamp() + self._default_flow_duration
142142
)
143+
self._flow_state.tag = FlowStateTag.COMPLETE
143144

144145
return token_response
145146

libraries/microsoft-agents-hosting-core/tests/test_oauth_flow.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ async def test_get_user_token_success(self, sample_flow_state, user_token_client
137137
flow = OAuthFlow(sample_flow_state, user_token_client)
138138
expected_final_flow_state = sample_flow_state
139139
expected_final_flow_state.user_token = RES_TOKEN
140+
expected_final_flow_state.tag = FlowStateTag.COMPLETE
140141

141142
# test
142143
token_response = await flow.get_user_token()
@@ -201,6 +202,7 @@ async def test_begin_flow_easy_case(
201202
activity = mocker.Mock(spec=Activity)
202203
expected_flow_state = sample_flow_state
203204
expected_flow_state.user_token = RES_TOKEN
205+
expected_flow_state.tag = FlowStateTag.COMPLETE
204206

205207
# test
206208
response = await flow.begin_flow(activity)

0 commit comments

Comments
 (0)