我有一个使用聚合物2.0和聚合物火力建造的PWA,是我的网络应用程序.我有一个快速应用程序充当云功能(微服务).例:exports.register=functions.https.onRequest(app);
如何添加重写规则来映射说明/fns/register和/fns/verify上面的应用程序register.
我firebase.json在云功能微服务项目中更新了我的文件,但是当我运行firebase deploy --only functions:register它时说没有公共文件夹来部署托管配置!
{
"hosting": {
"rewrites": [{
"source": "/fns/**", "function": "register"
}]
}
}
Run Code Online (Sandbox Code Playgroud)
在原始Web应用程序中维护重写规则可能是一种选择,但仍然不是理想的恕我直言.如果我要在原始的Web应用程序中执行此操作,我也尝试过,但无法实现.以下是我firebase.json在原始网络应用程序中的更新:
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "build/default/public",
"rewrites": [
{
"source": "/fns/**",
"function": "register"
},
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个使用firebase构建的Web应用程序.在我的网络应用程序中,我有google,firebase,twitter注册/登录功能.
现在我想将它与我的api.ai代理集成,并拥有一个无缝的帐户链接.因此,用户将使用移动设备上的googel Home/assistant应用程序连接到我的代理商.在这个阶段,我将拥有谷歌帐户ID,谷歌电子邮件,用户名.
如果用户已经在场,我可以发送我的代理所需的令牌.但如果用户是新用户,我想在我的firebase数据库中创建帐户.我无法手动在firebase中创建联合帐户(来自nodejs应用程序/云功能)!
我知道有可能创建一个电子邮件+虚拟密码帐户,但这不是我想要的.因为用户在尝试登录我的网络应用程序时注册了虚拟密码,所以会使用他们的谷歌登录功能.
如果我创建电子邮件和虚拟密码,流量不好,我将强制用户更改密码并在他们访问我的网络渠道时再次链接他们的Google帐户!
有CLI方法,我可以从文件中导入用户.如果有可能,有人可以帮助我如何在云功能中完成这项工作吗?
node.js firebase-authentication firebase-admin actions-on-google api-ai
是否可以声明一个自定义响应头,它将出现在所有响应中而不在每个响应结构中复制它?
我正在开发API AI代理,并尝试实现帐户链接功能.oauth2-codeflow上的文档非常有用,我可以在Google操场上创建我的oauth流程并对其进行测试.这一切都很好,直到这里.
但是,当我试图在网络模拟器中测试它时,我一直得到"看起来你的代理帐户尚未链接".我已经按照调试URL进行了登录和授权步骤.
根据这个问题:我应该期待浏览器被重定向到https://www.google.com/?result_code=SUCCESS&result_message=Accounts+now+linked,但我的浏览器总是被重定向到https://www.google.co.in/?gws_rd=cr&ei=QDOEWfCAPMHA0gSUvJj4Ag代理我仍然得到accounts not linked消息.
我可以看到Google能够使用grantType:authorization_code调用我的令牌端点,我的服务响应如下所述:
POST for /myendpoint/tokens has begun for: grantType:authorization_code clientId:google-clientid...8
Run Code Online (Sandbox Code Playgroud)
我的服务回复是:
{
"token_type":"bearer",
"access_token":"ab092868.....e804bcac",
"refresh_token":"e11e6d3054883...b30",
"expires_in":3600
}
Run Code Online (Sandbox Code Playgroud)
我已经完成了SO问题中的建议,但我的回复没有其他参数.它简单明了
我通过nodejs应用程序发送上述响应,代码如下:
res.setHeader('Cache-Control', 'no-store');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Content-Type', 'application/json;charset=UTF-8');
res.send(JSON.stringify(respObj));
Run Code Online (Sandbox Code Playgroud)
我现在真的很震惊,无法找到出路!请帮助.
我正在尝试调用谷歌地理编码API并检索响应.
lazy val geoCodingConnectionFlow: Flow[HttpRequest, HttpResponse, Any] =
Http().outgoingConnectionHttps(config.getString("services.geoCodingApiHost"), config.getInt("services.geoCodingApiPort"))
def geoCodingRequest(request: HttpRequest): Future[HttpResponse] = Source.single(request).via(geoCodingConnectionFlow).runWith(Sink.head)
/**
* This call to google service is limited
* @see https://developers.google.com/maps/documentation/geocoding/#Limits
*/
def ?(l: GeoLocation)(implicit ec: ExecutionContext): Future[Either[String, List[Result]]] = {
val latlang = s"17.3644264,78.3896741"
import org.json4s.native.Serialization
import org.json4s.NoTypeHints
import akka.http.scaladsl.model._
import akka.http.scaladsl.unmarshalling._
implicit val materializer = ActorMaterializer()
implicit val executor = system.dispatcher
implicit val formats = Serialization.formats(NoTypeHints)
geoCodingRequest(RequestBuilding.Get(s"${config.getString("services.geoCodingApiUrlPart")}?latlng=$latlang&key=${config.getString("services.geoCodingApiKey")}")).flatMap { response =>
val nonBinaryType = ContentTypes.`application/json`
def responseEntity: HttpEntity = response.entity
response.status match …Run Code Online (Sandbox Code Playgroud)