我想让sample auth linking Roku channel工作。我已经在我的Roku棒上安装了通道,设置了用于生成和验证令牌的端点,但无法让断开端点工作。 Roku Developer Documentation on Authentication and Linking也没用,因为该页面上的响应与我从应用程序实际返回的内容不匹配。
我断开的代码如下所示:
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)
任何一个能够帮助我解释发生了什么和出错的人?
出错的直接原因是:
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()