2017-10-03 1 views
0

Yammer API를 사용하는 Outsystems에서 앱을 만들고 있습니다. 문제는 Yammer 인증이 문제를 일으키는 것입니다.Yammer 인증 문제

yam.getLoginStatus(
function(response) { 
if (response.authResponse) { 
    console.log("logged in"); 
    $parameters.Token = response.access_token.token; 
    console.dir(response); //print user information to the console 
} 
else { 
    yam.platform.login(function (response) { //prompt user to login and authorize your app, as necessary 
    if (response.authResponse) { 
     console.dir(response); //print user information to the console 
     console.dir(response.access_token.token); 
     $parameters.Token = response.access_token.token; 
     console.dir($parameters.Token); 
    } 
    }); 
} 
} 
); 

그것은 성공적으로 내가 CONSOLE.LOG를 사용하여 확인할 수 있어요 토큰을,() 반환 페이지의 "OnReady"속성에서 다음 코드를 추가했습니다. 또한 OnClick 속성에 동일한 코드가있는 로그인 버튼을 추가했습니다.

OnReady에서 메시지 가져 오기 API 호출 (끝점 : https://www.yammer.com/api/v1/messages.json)을 수행하려고하면 문제가 발생하여 401 인증되지 않은 액세스 오류가 발생합니다. 그러나 OnReady를 추가로 사용하고 로그인 버튼을 클릭하면 API 호출이 성공합니다. 이유는 모르겠지만 토큰이 두 호출에서 모두 똑같기 때문에 사용자가 두 번 로그인 한 후에 작동합니까? 이 문제를 해결할 수있는 방법은 없나요?

P. 다른 끝점 (https://api.yammer.com/api/v1/messages.json)을 사용해 보았습니다. 나는 똑같은 문제를 겪고있다.

답변

0

콜백 기능 내에 $resolve()을 추가하십시오. 이 방법은 코드가 완료 될 때까지 기다렸다가 다음 jav에 계속합니다.