You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(dataverse): request the per-environment OAuth scope
Dataverse's API resource is the customer's own environment host. The provider
declared a static `https://dynamics.microsoft.com/user_impersonation`, which is
not an Entra Application ID URI — the Dataverse first-party app
(00000007-0000-0000-c000-000000000000) publishes `admin.services.crm.dynamics.com`,
its regional siblings, and `*.crm.dynamics.com` wildcards, and nothing matching
what we sent. Entra rejects it at /authorize, so this integration has never been
able to complete consent.
There is no tenant-agnostic alternative: the data-API resource *is* the org URL,
which is why the scope has to be built per connection rather than declared.
A service can now declare `resourceUrl`, and the connect modal collects that host,
validates it against the service's allowed domains, and sends
`origin + scopeSuffix` in the link request — Better Auth's link route replaces the
registered scopes with the body's, which is what makes this possible without a
second provider registration. Only Microsoft Dataverse declares it; the other 60
services take an unchanged path.
The three initiation surfaces that cannot collect a tenant host fail closed rather
than minting a token with no API audience: the desktop hand-off (its scope is
id-shaped, validated against ID_PATTERN in a separately released Electron binary,
so an installed shell would drop a new field), the Copilot auth-link tool (its
schema is generated from the Mothership catalog), and the authorize route the
desktop path redirects through.
`getDataverseBaseUrl` now shares one host list with the scope builder. Those had
drifted into separate copies, and the failure mode is quiet: a new Microsoft
sovereign cloud added on one side only produces a token whose audience the tools
then refuse to send to.
Not fixed here, and the integration stays non-functional until it is: the shared
Entra app registration needs the Dynamics CRM delegated permission before any of
these scopes can be consented to.
* Shown for a service whose OAuth resource is the customer's own tenant host.
40
+
* The desktop hand-off carries only id-shaped values, so that host cannot reach
41
+
* this page, and linking without it mints a token with no API audience — an
42
+
* opaque 401 later rather than a visible failure now.
43
+
*/
44
+
functionResourceUrlUnsupported(){
45
+
return(
46
+
<DesktopHandoffShell
47
+
title='Connect this account from your browser'
48
+
description='This integration needs its environment URL, which the desktop app cannot pass along. Open Sim in your browser and connect it from Settings → Integrations.'
49
+
/>
50
+
)
51
+
}
52
+
37
53
/**
38
54
* Desktop OAuth-connect landing. The desktop app opens this page in the
39
55
* system browser with the provider to connect, a one-time state, and the port
* A service whose OAuth resource is the customer's own tenant host needs that
211
+
* URL before the authorization request is built, and this tool has nowhere to
212
+
* take one from — its schema is generated from the Mothership catalog. An
213
+
* authorize link without it would request the wrong resource and fail at the
214
+
* provider.
215
+
*/
216
+
if(matched.resourceUrl){
217
+
thrownewError(
218
+
`${serviceName} needs its environment URL to connect, which this tool cannot supply. Ask the user to connect ${serviceName} from Settings → Integrations.`
0 commit comments