Skip to content

Conversation

@rodrigobr-msft
Copy link
Contributor

@rodrigobr-msft rodrigobr-msft commented Oct 2, 2025

This pull request introduces a new unified method for obtaining either a user token or a sign-in resource in the OAuth flow, simplifying how authentication is handled and reducing redundant code paths. The changes span both the activity and hosting core libraries, with adjustments to models, API client interfaces, and the OAuth flow logic.

OAuth Flow Improvements:

  • Added the new TokenOrSignInResourceResponse model and related imports to microsoft_agents/activity/__init__.py to support unified token/sign-in responses.
  • Refactored the OAuth flow logic in _oauth_flow.py to use the new _get_token_or_sign_in_resource method, streamlining the process of obtaining a user token or sign-in resource and removing the need for separate continuation activity handling. [1] [2] [3] [4]

API Client Changes:

  • Implemented the _get_token_or_sign_in_resource method in user_token_client.py and updated imports to include the new response model, enabling the client to handle both token and sign-in resource retrieval in a single call. [1] [2]
  • Declared the new abstract method _get_token_or_sign_in_resource in user_token_base.py to ensure all token client implementations support this unified interface.

Model Additions:

  • Added the TokenOrSignInResource model to encapsulate both TokenResponse and SignInResource in a single response type, supporting the new unified authentication flow.

@rodrigobr-msft rodrigobr-msft linked an issue Oct 2, 2025 that may be closed by this pull request
@rodrigobr-msft rodrigobr-msft marked this pull request as ready for review October 8, 2025 18:24
Copy link
Collaborator

@cleemullins cleemullins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome. Minor nitpicks.

@rodrigobr-msft rodrigobr-msft merged commit b1930c9 into main Oct 8, 2025
8 checks passed
@rodrigobr-msft rodrigobr-msft deleted the users/robrandao/get-token-or-sign-in branch October 8, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Updated GetTokenOrSignInResource pattern

4 participants