重新询问same问题,因为:
Database Secrets
warning
Database secrets are currently deprecated and use a legacy Firebase token generator. Update your source code with the Firebase Admin SDK.
获得“秘密”时 - 我推断它们意味着秘密密钥。
供参考:
thufir@dur:~/ruby/firebase$
thufir@dur:~/ruby/firebase$ ./quickstart.rb
true
200
{"name"=>"-Kxf9rMd9p1F0cb2HTeM"}
thufir@dur:~/ruby/firebase$
thufir@dur:~/ruby/firebase$ cat quickstart.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'firebase'
require 'pp'
require_relative 'config'
config = Config.new
#firebase = Firebase::Client.new(config.database_url)
firebase = Firebase::Client.new(config.database_url,config.database_secret)
response = firebase.push("todos", { :name => 'Pick the milk', :priority => 1 })
pp response.success? # => true
pp response.code # => 200
pp response.body # => { 'name' => "-INOQPH-aV_psbk3ZXEX" }
response.raw_body # => '{"name":"-INOQPH-aV_psbk3ZXEX"}'
thufir@dur:~/ruby/firebase$
这种方法相对稳定吗?我从Google控制台GUI复制了信息:
Add Firebase to your web app
Copy and paste the snippet below at the bottom of your HTML, before other script tags.
进入配置文件以供参考。 (可能应该使用yaml或类似的;现在可以使用。)