@openinc/parse-server-opendash 3.29.8 → 3.29.10
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.
|
@@ -39,8 +39,8 @@ function getKey(header, callback) {
|
|
|
39
39
|
* @param accessToken The access token to authenticate the request.
|
|
40
40
|
* @returns The email address of the user.
|
|
41
41
|
*/
|
|
42
|
-
async function getUserMail(accessToken) {
|
|
43
|
-
const response = await fetch(
|
|
42
|
+
async function getUserMail(accessToken, userid) {
|
|
43
|
+
const response = await fetch(`https://graph.microsoft.com/v1.0/users/${userid}`, {
|
|
44
44
|
method: "GET",
|
|
45
45
|
headers: {
|
|
46
46
|
Authorization: `Bearer ${accessToken}`,
|
|
@@ -52,6 +52,7 @@ async function getUserMail(accessToken) {
|
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
54
54
|
const data = (await response.json());
|
|
55
|
+
console.log("Fetched Microsoft user data:", data);
|
|
55
56
|
if (data.mail) {
|
|
56
57
|
return data.mail;
|
|
57
58
|
}
|
|
@@ -101,7 +102,10 @@ async function init(name) {
|
|
|
101
102
|
resolve(decoded);
|
|
102
103
|
});
|
|
103
104
|
});
|
|
104
|
-
|
|
105
|
+
let usermail = null;
|
|
106
|
+
if (verifiedPayload.oid) {
|
|
107
|
+
usermail = await getUserMail(token, verifiedPayload.oid);
|
|
108
|
+
}
|
|
105
109
|
const defaultTenant = await new Parse.Query(types_1.Tenant)
|
|
106
110
|
.ascending("createdAt")
|
|
107
111
|
.first({ useMasterKey: true });
|