Skip to content

Add GET_DEVICE_TOKEN_V1 protocol with required clientId parameter, Fixes AB#3658756#3147

Open
mohitc1 wants to merge 8 commits into
devfrom
mchand/get-device-token-v1-clientid
Open

Add GET_DEVICE_TOKEN_V1 protocol with required clientId parameter, Fixes AB#3658756#3147
mohitc1 wants to merge 8 commits into
devfrom
mchand/get-device-token-v1-clientid

Conversation

@mohitc1

@mohitc1 mohitc1 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
  • Add GET_DEVICE_TOKEN_V1 protocol constant
  • New GetDeviceTokenV1Parameters with @nonnull clientId field
  • New GetDeviceTokenV1Response
  • New getDeviceToken overload accepting clientId in DeviceRegistrationClientApplication
  • Deprecate old getDeviceToken overload (V0, no clientId)
  • Unit tests for V1 parameters serialization and DRCA integration

AB#3658756

- Add GET_DEVICE_TOKEN_V1 protocol constant
- New GetDeviceTokenV1Parameters with @nonnull clientId field
- New GetDeviceTokenV1Response
- New getDeviceToken overload accepting clientId in DeviceRegistrationClientApplication
- Deprecate old getDeviceToken overload (V0, no clientId)
- Unit tests for V1 parameters serialization and DRCA integration

AB#3658756
@github-actions

Copy link
Copy Markdown

✅ Work item link check complete. Description contains link AB#3658756 to an Azure Boards work item.

@mohitc1 mohitc1 marked this pull request as ready for review June 10, 2026 01:18
@mohitc1 mohitc1 requested a review from a team as a code owner June 10, 2026 01:18
Copilot AI review requested due to automatic review settings June 10, 2026 01:18
@mohitc1 mohitc1 requested a review from a team as a code owner June 10, 2026 01:18
@github-actions github-actions Bot changed the title Add GET_DEVICE_TOKEN_V1 protocol with required clientId parameter Add GET_DEVICE_TOKEN_V1 protocol with required clientId parameter, Fixes AB#3658756 Jun 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the device registration IPC/protocol surface to support a new GET_DEVICE_TOKEN_V1 protocol that requires a clientId, and updates DeviceRegistrationClientApplication to expose a new getDeviceToken overload using V1 while deprecating the legacy V0 overload.

Changes:

  • Add GET_DEVICE_TOKEN_V1 protocol constant plus new V1 protocol parameter/response types (GetDeviceTokenV1Parameters, GetDeviceTokenV1Response).
  • Add a new DeviceRegistrationClientApplication.getDeviceToken(..., clientId, scope) overload and deprecate the V0 overload.
  • Add/extend unit tests for V1 serialization and DRCA integration; update changelog.txt.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
common4j/src/test/com/microsoft/identity/deviceregistration/java/protocol/parameters/GetDeviceTokenV1ParametersTest.kt Adds unit tests validating V1 parameter serialization/deserialization and getters.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/response/GetDeviceTokenV1Response.java Introduces the V1 protocol response payload for returning a device token.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/parameters/GetDeviceTokenV1Parameters.java Introduces the V1 protocol parameters including required clientId.
common4j/src/main/com/microsoft/identity/deviceregistration/java/protocol/DeviceRegistrationProtocolConstants.java Adds the GET_DEVICE_TOKEN_V1 protocol constant.
common/src/test/java/com/microsoft/identity/deviceregistration/api/DeviceRegistrationClientApplicationTest.kt Adds DRCA integration tests for V1 and validates V0 deprecated behavior.
common/src/main/java/com/microsoft/identity/deviceregistration/api/DeviceRegistrationClientApplication.kt Adds V1 overload, deprecates V0 overload, and routes execution to the correct protocol types.
changelog.txt Adds a vNext release note entry for the new V1 protocol and V0 deprecation.

Mohit and others added 6 commits June 10, 2026 08:35
… app registry

- Restore @jvmoverloads and default scope=null on deprecated getDeviceToken
- Remove invalid replaceWith referencing out-of-scope clientId
- Add MDE (com.microsoft.scmx) to GET_DEVICE_TOKEN_AUTHORIZED_APPS and SSO_TOKEN_AUTHORIZED_APPS
- Add PR number to changelog entry
- Add @nonnull redirectUri field to GetDeviceTokenV1Parameters
- Add redirectUri param to DeviceRegistrationClientApplication.getDeviceToken V1 overload
- Update tests to include redirectUri
val methodTag = "$TAG:getDeviceToken"
Logger.info(methodTag, "GetDeviceToken (V1) started. CorrelationId: $correlationId")
val responseSerialized = mController.execute(
GetDeviceTokenV1Parameters(correlationId, deviceRegistrationRecord, resources, clientId, redirectUri, scope)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what happens when this V1 overload is called against a broker that doesn't have the V1 executor yet?

i looked locally and neither DeviceRegistrationProtocolExecutorFactory nor the WpjLegacy one has a GET_DEVICE_TOKEN_V1 case, so the call would throw BrokerUpdateRequiredException. is the plan to ship the broker companion first and let it age in field, or have callers catch and fall back to V0?

correlationId: UUID,
clientId: String,
redirectUri: String,
scope: String? = null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jvmoverloads on this one too? the deprecated overload has it. java callers wouldn't be able to omit scope otherwise.

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.

3 participants