我目前正在使用以下代码作为服务帐户进行身份验证:
const auth = new google.auth.GoogleAuth({
keyFile: "<path/to/credentials>",
scopes: [<scopes>],
});
Run Code Online (Sandbox Code Playgroud)
有没有办法使用包含与 keyFile 相同内容的 JSON 对象进行身份验证?例如,做这样的事情:
const credentials = {
"type": ...,
"project_id": ...,
"private_key_id": ...,
"private_key": ...,
"client_email": ...,
"client_id": ...,
"auth_uri": ...,
"token_uri": ...,
"auth_provider_x509_cert_url": ...,
"client_x509_cert_url": ...
}
const auth = new google.auth.GoogleAuth({
keyFile: credentials,
scopes: [<scopes>],
});
Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个 iOS 应用程序,我需要连接到另一台设备。使用 TCP 成功建立了 NWConnection,我可以从远程设备接收一条(并且只有一条)消息并立即收到错误消息。连接被取消(我猜是由错误引起的)。控制台日志显示:
Hello World.
[connection] nw_flow_add_read_request [C1 <ip and port of remote device> ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] already delivered final read, cannot accept read requests
[connection] nw_read_request_report [C1] Receive failed with error "No message available on STREAM"
error
Run Code Online (Sandbox Code Playgroud)
我的代码如下所示:
Hello World.
[connection] nw_flow_add_read_request [C1 <ip and port of remote device> ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] already delivered final read, cannot accept …Run Code Online (Sandbox Code Playgroud)