@azure/identity-broker 1.0.1-alpha.20240308.3 → 1.0.1-alpha.20240321.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +36 -3
  2. package/package.json +2 -4
package/README.md CHANGED
@@ -65,8 +65,8 @@ useIdentityPlugin(nativeBrokerPlugin);
65
65
  const credential = new InteractiveBrowserCredential({
66
66
  brokerOptions: {
67
67
  enabled: true,
68
- },
69
- });
68
+ },
69
+ });
70
70
  ```
71
71
 
72
72
  After calling `useIdentityPlugin`, the native broker plugin is registered to the `@azure/identity` package and will be available on the `InteractiveBrowserCredential` that supports WAM broker authentication. This credential has `brokerOptions` in the constructor options.
@@ -101,7 +101,40 @@ main().catch((error) => {
101
101
  process.exit(1);
102
102
  });
103
103
  ```
104
- For an example of using an Electron app for retrieving a window handle, see [this sample](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity-broker/samples/v1/typescript/src/index.ts).
104
+
105
+ For a complete example of using an Electron app for retrieving a window handle, see [this sample](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity-broker/samples/v1/typescript/src/index.ts).
106
+
107
+ ### Use the default account for sign-in
108
+
109
+ When the `useDefaultBrokerAccount` option is set to `true`, the credential will attempt to silently use the default broker account. If using the default account fails, the credential will fall back to interactive authentication.
110
+
111
+ ```typescript
112
+ import { nativeBrokerPlugin } from "@azure/identity-broker";
113
+ import { useIdentityPlugin, InteractiveBrowserCredential } from "@azure/identity";
114
+
115
+ useIdentityPlugin(nativeBrokerPlugin);
116
+
117
+ async function main() {
118
+ const credential = new InteractiveBrowserCredential({
119
+ brokerOptions: {
120
+ enabled: true,
121
+ useDefaultBrokerAccount: true,
122
+ parentWindowHandle: <insert_current_window_handle>
123
+ },
124
+ });
125
+
126
+ // We'll use the Microsoft Graph scope as an example
127
+ const scope = "https://graph.microsoft.com/.default";
128
+
129
+ // Print out part of the access token
130
+ console.log((await credential.getToken(scope)).token.substr(0, 10), "...");
131
+ }
132
+
133
+ main().catch((error) => {
134
+ console.error("An error occurred:", error);
135
+ process.exit(1);
136
+ });
137
+ ```
105
138
 
106
139
  ## Troubleshooting
107
140
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/identity-broker",
3
- "version": "1.0.1-alpha.20240308.3",
3
+ "version": "1.0.1-alpha.20240321.3",
4
4
  "sdk-type": "client",
5
5
  "description": "A native plugin for Azure Identity credentials to enable broker authentication such as WAM",
6
6
  "main": "dist/index.js",
@@ -75,15 +75,13 @@
75
75
  "@types/mocha": "^10.0.0",
76
76
  "@types/node": "^18.0.0",
77
77
  "@types/sinon": "^17.0.0",
78
- "@types/wtfnode": "0.7.2",
79
78
  "cross-env": "^7.0.2",
80
79
  "eslint": "^8.0.0",
81
80
  "mocha": "^10.0.0",
82
81
  "puppeteer": "^22.2.0",
83
82
  "rimraf": "^5.0.1",
84
83
  "typescript": "~5.3.3",
85
- "sinon": "^17.0.0",
86
- "wtfnode": "0.9.1"
84
+ "sinon": "^17.0.0"
87
85
  },
88
86
  "//sampleConfiguration": {
89
87
  "productName": "Azure Identity Brokered Auth Plugin",