I can’t get the token from the office365 API, it worked from the last 7 to 8 months, but suddenly I get the error message “waiting for an array or iterative object, but received [Null object]”.
You guys see my code here
var oauth2 = require("simple-oauth2")(ConfigOutlookCredentials); var scopes = ["openid","offline_access","profile", //here 'profile' is added bz not able to getting EmailId in this function getEmailFromIdToken. "https://outlook.office.com/mail.read", "https://outlook.office.com/calendars.readwrite" ]; function getTokenFromCode(auth_code,callback) { logger.MessageQueueLog.log("info","auth_code: "+auth_code+" || redirectUri: "+redirectUri+" || scopes: "+scopes); oauth2.authCode.getToken({ code: auth_code, redirect_uri: redirectUri, scope: scopes.join(" ") }, function(error, result) { logger.MessageQueueLog.log("info","error: "+util.format('%j',error.message)+" || result: "+util.format('%j',result)); if (error) { return callback(error,null); } else { var token = oauth2.accessToken.create(result); return callback(null,token); } }); }
I get the code after redirecting to my rediredct Url and the same code that is passed above the "getTokenFromCode" function, but I get an error, i.e. " expects an array or iterable object, but received [object Null] ."
Please help me deal with the problem. Thanks at Advance.
source share