2017-12-27 4 views
0

私はsample auth linking Roku channelを動作させようとしています。 Rokuスティックにチャンネルをインストールし、トークンの生成と認証のためのエンドポイントを設定しましたが、切断エンドポイントを動作させることはできません。 Roku Developer Documentation on Authentication and Linkingも役に立たない。なぜなら、そのページの回答は私のアプリケーションから実際に返されたものと一致しないからだ。Rokuチャンネルで切断しようとするとエラーが発生します

次のようになり切断する私のコード:私のアプリケーションからそう

sub parseDis(job as object) 
    result = job.context.context.response 
    json = parseJSON(result.content) 
    if json.success = "no" 
    m.top.disconnect = false 
    else 
    m.top.disconnect = true 
    end if 
end sub 

を、私はこのようになりますJSONレスポンスを返しています:

{ 
    "success": "yes" 
} 

しかし、Telnetのデバッグコンソールセッションで私はこの出力を得ます:

Suspending threads... 
Thread selected: 2* ...:/components/RegistryTask.xml(55)  
Current Function: 
052: sec.Write(key, val) 
     Function RegWrite(key, val, section=invalid) 
053:   if section = invalid then section = "Default" 
054:   sec = CreateObject("roRegistrySection", section) 
055:*   sec.Write(key, val) 
056:   sec.Flush() 'commit it 
057:  End Function 
Type Mismatch. (runtime error &h18) in pkg:/components/RegistryTask.xml(55) 
055:   sec.Write(key, val) 
Backtrace: 
#1 Function regwrite(key As Dynamic, val As Dynamic) As Dynamic 
    file/line: pkg:/components/RegistryTask.xml(55) 
#0 Function go() As Void 
    file/line: pkg:/components/RegistryTask.xml(35) 
Local Variables: 
key    roString refcnt=3 val:"UNIQUE_ID_HERE3500X" 
val    Invalid 
section   String (VT_STR_CONST) val:"Default" 
global   Interface:ifGlobal 
m    roAssociativeArray refcnt=3 count:3 
sec    bsc:roRegistrySection refcnt=1 
Threads: 
ID Location        Source Code 
0 pkg:/source/main.brs(15)    msg = wait(0, m.port) 
1 pkg:/components/SimpleScene.brs(78)  oauth_token: invalid 
2* ...:/components/RegistryTask.xml(55) sec.Write(key, val) 
3[u] ?? 
    *selected [u]unattached(not debuggable) 

何が起きているのか解読を助けることができる人間違っている?

答えて

1

エラーのための即時の理由はこれです:

key    roString refcnt=3 val:"UNIQUE_ID_HERE3500X" 
val    Invalid 

Write()機能は、キーと値の2つの文字列を取る - と、この場合の値は、何も良いinvalidではありません。

私は、サンプルアプリケーションを簡単に見ていたし、背後にある深い理由がonDisconnect()イベントハンドラがないということである:一つの方法または別のを固定する必要がある

m.regTask.write = { 
    deviceID: m.rokuDeviceID, 
    oauth_token: invalid 
} 

。私は詳細を見なかった。空の文字列がロジックにやりとりするか、よりよく使う場合roRegistrySection.delete()

関連する問題