2017-06-27 13 views
1

MediaHound SDKを透明化せずに使用する単純なJavaScriptアプリケーションを構築しようとしています。MediaHound APIを使用する際に問題が発生しました

enter image description here

<oauth> 
    <error_description> 
    Full authentication is required to access this resource 
    </error_description> 
    <error>unauthorized</error> 
</oauth> 

私は方向here次のようだ:ここで私が得ているエラーです。 MediaHoundのアプリケーション画面でアプリケーションを設定しましたが、クライアントIDとクライアントシークレットが適切に設定されています(変更すると、別のエラーが発生します)。私はこれでhound.jsと私のメインのjsファイルを含めてい

は:最初の行は罰金実行

houndjs.MHSDK.configure('mhclt_Zoetrope', 'My Client Secret is here'); 

houndjs.MHSearch.fetchResultsForSearchTerm('Gladiator', [houndjs.MHSearch.SCOPE_MOVIE]) 
    .then(response => { 
    const movie = response.content[0].object; 
    console.log('First result:', movie.metadata.name); 
    }); 

、それはエラーを投げるの検索です。私は明白な間違いをしていますか?

答えて

1

問題は、認証が行われる前にすぐに検索が実行されることです。作品:

houndjs.MHSDK.configure('mhclt_Zoetrope', 'My Client Secret is here').then(() => { 

    houndjs.MHSearch.fetchResultsForSearchTerm('Gladiator', [houndjs.MHSearch.SCOPE_MOVIE]) 
    .then(response => { 
     const movie = response.content[0].object; 
     console.log('First result:', movie.metadata.name); 
    }); 

}); 
関連する問題