@openinc/parse-server-opendash 3.29.10 → 3.29.11
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.
|
@@ -40,7 +40,8 @@ function getKey(header, callback) {
|
|
|
40
40
|
* @returns The email address of the user.
|
|
41
41
|
*/
|
|
42
42
|
async function getUserMail(accessToken, userid) {
|
|
43
|
-
|
|
43
|
+
console.log("Fetching Microsoft user info for user ID:", userid, "with token:", accessToken);
|
|
44
|
+
const response = await fetch(`https://graph.microsoft.com/v1.0/me`, {
|
|
44
45
|
method: "GET",
|
|
45
46
|
headers: {
|
|
46
47
|
Authorization: `Bearer ${accessToken}`,
|
|
@@ -67,6 +68,7 @@ async function init(name) {
|
|
|
67
68
|
Parse.Cloud.define(name, async (request) => {
|
|
68
69
|
const token = request.params.token;
|
|
69
70
|
const account = request.params.account;
|
|
71
|
+
console.log(JSON.stringify(request.params));
|
|
70
72
|
if (!token) {
|
|
71
73
|
throw new Parse.Error(Parse.Error.INVALID_JSON, "Token missing");
|
|
72
74
|
}
|
|
@@ -102,6 +104,7 @@ async function init(name) {
|
|
|
102
104
|
resolve(decoded);
|
|
103
105
|
});
|
|
104
106
|
});
|
|
107
|
+
console.log("Payload: ", JSON.stringify(verifiedPayload));
|
|
105
108
|
let usermail = null;
|
|
106
109
|
if (verifiedPayload.oid) {
|
|
107
110
|
usermail = await getUserMail(token, verifiedPayload.oid);
|
|
@@ -116,7 +119,6 @@ async function init(name) {
|
|
|
116
119
|
let oldUser = (await new Parse.Query(Parse.User)
|
|
117
120
|
.equalTo("username", verifiedPayload.oid)
|
|
118
121
|
.first({ useMasterKey: true }));
|
|
119
|
-
console.log("Payload: ", JSON.stringify(verifiedPayload), "account:", JSON.stringify(account));
|
|
120
122
|
if (!user && !oldUser) {
|
|
121
123
|
user = new Parse.User();
|
|
122
124
|
user.set("username", account.username);
|