@pnp/cli-microsoft365 6.9.0-beta.1cd2525 → 6.9.0-beta.3b4f31c
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.
|
@@ -19,6 +19,7 @@ const fs = require("fs");
|
|
|
19
19
|
const Auth_1 = require("../../Auth");
|
|
20
20
|
const Command_1 = require("../../Command");
|
|
21
21
|
const config_1 = require("../../config");
|
|
22
|
+
const accessToken_1 = require("../../utils/accessToken");
|
|
22
23
|
const misc_1 = require("../../utils/misc");
|
|
23
24
|
const commands_1 = require("./commands");
|
|
24
25
|
class LoginCommand extends Command_1.default {
|
|
@@ -90,6 +91,25 @@ class LoginCommand extends Command_1.default {
|
|
|
90
91
|
}
|
|
91
92
|
throw new Command_1.CommandError(error.message);
|
|
92
93
|
}
|
|
94
|
+
if (this.debug) {
|
|
95
|
+
logger.logToStderr({
|
|
96
|
+
connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken),
|
|
97
|
+
authType: Auth_1.AuthType[Auth_1.default.service.authType],
|
|
98
|
+
appId: Auth_1.default.service.appId,
|
|
99
|
+
appTenant: Auth_1.default.service.tenant,
|
|
100
|
+
accessToken: JSON.stringify(Auth_1.default.service.accessTokens, null, 2),
|
|
101
|
+
cloudType: Auth_1.CloudType[Auth_1.default.service.cloudType]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
logger.logToStderr({
|
|
106
|
+
connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken),
|
|
107
|
+
authType: Auth_1.AuthType[Auth_1.default.service.authType],
|
|
108
|
+
appId: Auth_1.default.service.appId,
|
|
109
|
+
appTenant: Auth_1.default.service.tenant,
|
|
110
|
+
cloudType: Auth_1.CloudType[Auth_1.default.service.cloudType]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
93
113
|
});
|
|
94
114
|
try {
|
|
95
115
|
yield Auth_1.default.clearConnectionInfo();
|
|
@@ -41,39 +41,28 @@ class OneDriveListCommand extends SpoCommand_1.default {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
getAllSites(spoAdminUrl, startIndex, formDigest, logger) {
|
|
44
|
-
return
|
|
45
|
-
spo_1.spo
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
else {
|
|
65
|
-
const sites = json[json.length - 1];
|
|
66
|
-
this.allSites.push(...sites._Child_Items_);
|
|
67
|
-
if (sites.NextStartIndexFromSharePoint) {
|
|
68
|
-
this
|
|
69
|
-
.getAllSites(spoAdminUrl, sites.NextStartIndexFromSharePoint, formDigest, logger)
|
|
70
|
-
.then(_ => resolve(), err => reject(err));
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
resolve();
|
|
74
|
-
}
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const formDigestInfo = yield spo_1.spo.ensureFormDigest(spoAdminUrl, logger, formDigest, this.debug);
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
48
|
+
headers: {
|
|
49
|
+
'X-RequestDigest': formDigestInfo.FormDigestValue
|
|
50
|
+
},
|
|
51
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><Query Id="5" ObjectPathId="3"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="3" ParentId="1" Name="GetSitePropertiesFromSharePointByFilters"><Parameters><Parameter TypeId="{b92aeee2-c92c-4b67-abcc-024e471bc140}"><Property Name="IncludeDetail" Type="Boolean">false</Property><Property Name="IncludePersonalSite" Type="Enum">1</Property><Property Name="StartIndex" Type="String">${startIndex}</Property><Property Name="Template" Type="String">SPSPERS</Property></Parameter></Parameters></Method></ObjectPaths></Request>`
|
|
52
|
+
};
|
|
53
|
+
const res = yield request_1.default.post(requestOptions);
|
|
54
|
+
const json = JSON.parse(res);
|
|
55
|
+
const response = json[0];
|
|
56
|
+
if (response.ErrorInfo) {
|
|
57
|
+
throw (response.ErrorInfo.ErrorMessage);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const sites = json[json.length - 1];
|
|
61
|
+
this.allSites.push(...sites._Child_Items_);
|
|
62
|
+
if (sites.NextStartIndexFromSharePoint) {
|
|
63
|
+
yield this.getAllSites(spoAdminUrl, sites.NextStartIndexFromSharePoint, formDigest, logger);
|
|
75
64
|
}
|
|
76
|
-
}
|
|
65
|
+
}
|
|
77
66
|
});
|
|
78
67
|
}
|
|
79
68
|
}
|
package/docs/docs/cmd/login.mdx
CHANGED
|
@@ -177,6 +177,16 @@ m365 login --authType secret --secret topSeCr3t@007
|
|
|
177
177
|
```json
|
|
178
178
|
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code CQBMTLEFC to authenticate.
|
|
179
179
|
```
|
|
180
|
+
Upon successful login:
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"connectedAs": "john.doe@contoso.onmicrosoft.com",
|
|
184
|
+
"authType": "DeviceCode",
|
|
185
|
+
"appId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
|
|
186
|
+
"appTenant": "common",
|
|
187
|
+
"cloudType": "Public"
|
|
188
|
+
}
|
|
189
|
+
```
|
|
180
190
|
|
|
181
191
|
</TabItem>
|
|
182
192
|
<TabItem value="Text">
|
|
@@ -184,6 +194,14 @@ m365 login --authType secret --secret topSeCr3t@007
|
|
|
184
194
|
```text
|
|
185
195
|
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code CQBMTLEFC to authenticate.
|
|
186
196
|
```
|
|
197
|
+
Upon successful login:
|
|
198
|
+
```text
|
|
199
|
+
appId : 31359c7f-bd7e-475c-86db-fdb8c937548e
|
|
200
|
+
appTenant : common
|
|
201
|
+
authType : DeviceCode
|
|
202
|
+
connectedAs: john.doe@contoso.onmicrosoft.com,
|
|
203
|
+
cloudType : Public
|
|
204
|
+
```
|
|
187
205
|
|
|
188
206
|
</TabItem>
|
|
189
207
|
<TabItem value="CSV">
|
|
@@ -191,6 +209,11 @@ m365 login --authType secret --secret topSeCr3t@007
|
|
|
191
209
|
```csv
|
|
192
210
|
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code CQBMTLEFC to authenticate.
|
|
193
211
|
```
|
|
212
|
+
Upon successful login:
|
|
213
|
+
```csv
|
|
214
|
+
connectedAs,authType,appId,appTenant,cloudType
|
|
215
|
+
john.doe@contoso.onmicrosoft.com,DeviceCode,31359c7f-bd7e-475c-86db-fdb8c937548e,common,Public
|
|
216
|
+
```
|
|
194
217
|
|
|
195
218
|
</TabItem>
|
|
196
219
|
<TabItem value="Markdown">
|
|
@@ -198,6 +221,22 @@ m365 login --authType secret --secret topSeCr3t@007
|
|
|
198
221
|
```md
|
|
199
222
|
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code CQBMTLEFC to authenticate.
|
|
200
223
|
```
|
|
224
|
+
Upon successful login:
|
|
225
|
+
```md
|
|
226
|
+
# status
|
|
227
|
+
|
|
228
|
+
Date: 7/2/2023
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
Property | Value
|
|
233
|
+
---------|-------
|
|
234
|
+
connectedAs | john.doe@contoso.onmicrosoft.com
|
|
235
|
+
authType | DeviceCode
|
|
236
|
+
appId | 31359c7f-bd7e-475c-86db-fdb8c937548e
|
|
237
|
+
appTenant | common
|
|
238
|
+
cloudType | Public
|
|
239
|
+
```
|
|
201
240
|
|
|
202
241
|
</TabItem>
|
|
203
242
|
</Tabs>
|
package/docs/docs/cmd/status.mdx
CHANGED
|
@@ -38,7 +38,8 @@ m365 status
|
|
|
38
38
|
"connectedAs": "john.doe@contoso.onmicrosoft.com",
|
|
39
39
|
"authType": "DeviceCode",
|
|
40
40
|
"appId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
|
|
41
|
-
"appTenant": "common"
|
|
41
|
+
"appTenant": "common",
|
|
42
|
+
"cloudType": "Public"
|
|
42
43
|
}
|
|
43
44
|
```
|
|
44
45
|
|
|
@@ -50,14 +51,15 @@ m365 status
|
|
|
50
51
|
appTenant : common
|
|
51
52
|
authType : DeviceCode
|
|
52
53
|
connectedAs: john.doe@contoso.onmicrosoft.com
|
|
54
|
+
cloudType : Public
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
</TabItem>
|
|
56
58
|
<TabItem value="CSV">
|
|
57
59
|
|
|
58
60
|
```csv
|
|
59
|
-
connectedAs,authType,appId,appTenant
|
|
60
|
-
john.doe@contoso.onmicrosoft.com,DeviceCode,31359c7f-bd7e-475c-86db-fdb8c937548e,common
|
|
61
|
+
connectedAs,authType,appId,appTenant,cloudType
|
|
62
|
+
john.doe@contoso.onmicrosoft.com,DeviceCode,31359c7f-bd7e-475c-86db-fdb8c937548e,common,Public
|
|
61
63
|
```
|
|
62
64
|
|
|
63
65
|
</TabItem>
|
|
@@ -76,6 +78,7 @@ m365 status
|
|
|
76
78
|
authType | DeviceCode
|
|
77
79
|
appId | 31359c7f-bd7e-475c-86db-fdb8c937548e
|
|
78
80
|
appTenant | common
|
|
81
|
+
cloudType | Public
|
|
79
82
|
```
|
|
80
83
|
|
|
81
84
|
</TabItem>
|
package/package.json
CHANGED