Sign up for Hasura Newsletter
Loading...

添加远程模式

我们已编写自定义解析器并将其部署到 Glitch。 我们已准备好 GraphQL 端点。 让我们将其添加到 Hasura,作为一个远程模式。

添加

转到控制台的Remote Schemas选项卡,然后单击Add按钮。

添加远程模式

为该远程模式命名(比如 Auth0)。 在 GraphQL 服务器 URL 中,输入你刚刚在上一步部署的 Glitch 应用程序 url。

选择Add Remote Schema,然后单击Forward all headers from the client

试一下

转到“控制台 GraphiQL”选项卡,然后了解以下 GraphQL 查询。

query {
auth0 {
email
picture
}
}

还记得我们在配置 Auth0 并将其测试后得到的 JWT 令牌吗? 在这里,你还需要使用相同的 JWT 令牌传入Authorization标头,以获取正确的数据。

远程模式查询

如你所见,Hasura 已通过 Postgres 将自定义 GraphQL 模式与现有的自动生成的 API 合并。

Did you find this page helpful?
Start with GraphQL on Hasura for Free
  • ArrowBuild apps and APIs 10x faster
  • ArrowBuilt-in authorization and caching
  • Arrow8x more performant than hand-rolled APIs
Promo
footer illustration
Brand logo
© 2024 Hasura Inc. All rights reserved
Github
Titter
Discord
Facebook
Instagram
Youtube
Linkedin