2017-07-28 16 views
5

Office365 takvim API'sinden jeton alamıyorum, Son 7 - 8 ay arasında çalışıyordu ama aniden bir dizi veya bir yinelenen nesne bekliyordum ama hata alıyorum [nesne boş].oauth2 office365 takviminden Simge alamadı API

Hâlâ ben bekliyordum Hata yani "alıyorum, burada kodumu

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); 
    } 
    }); 
} 

benim rediredct URL ve "getTokenFromCode" Yukarıdaki işlevine geçen aynı koda yönlendirme sonra kod alıyorum görebilirsiniz dizi veya yinelenen bir nesne ancak [object Null] var ".

Sorunu çözmeme yardım edin. Önceden teşekkürler.

cevap

0

Aynı hatayı aldım.

var oauth2 = require('simple-oauth2').create({ 
      client: { 
       id: service_data.clientID, 
       secret: service_data.clientSecret 
      }, 
      auth: { 
       tokenHost: service_data.site, 
       tokenPath: service_data.tokenPath 
      } 
     } 

    ); 

    var tokenConfig = { 
     code: data.code, 
     redirect_uri: data.redirect_uri 
    }; 

    return oauth2.authorizationCode.getToken(tokenConfig); 

bu bir söz verir: Benim böyle bir kodla https://github.com/lelylan/simple-oauth2 ilerliyordu için Sen https://github.com/jonathansamines/simple-oauth2

Çözüm basit-OAuth2-sözünü kullanıyor. umarım yardımcı olur!