graphql-auth:Graph GraphQL身份验证和授权中间件

时间:2021-05-02 15:51:43
【文件属性】:
文件名称:graphql-auth:Graph GraphQL身份验证和授权中间件
文件大小:104KB
文件格式:ZIP
更新时间:2021-05-02 15:51:43
TypeScript GraphQL身份验证 :locked: GraphQL的身份验证和授权中间件。 graphql-auth是一个非常简单的中间件,可以轻松地与遵循GraphQL API的解析器的任何GraphQL服务器集成。 入门 这个怎么运作 graphql-auth出口单一功能(中间件) withAuth 。 此函数有两个参数,第一个是授权scope (如果有的话),第二个是完成身份验证检查后要调用的callback 。 让我们看一个例子: import withAuth from 'graphql-auth' ; const resolvers = { Query : { users : withAuth ( [ 'users:view' ] , ( root , args , context ) => { ... } ) , ... } } 它的工作方式是withAuth ,它在
【文件预览】:
graphql-auth-master
----.gitignore(34B)
----.all-contributorsrc(1KB)
----package.json(754B)
----src()
--------index.ts(2KB)
----LICENSE(1KB)
----tsconfig.json(528B)
----.github()
--------workflows()
----readme.md(5KB)
----test()
--------index.test.ts(2KB)
----yarn.lock(255KB)

网友评论