graphql-python / graphql-python/flask-graphql

Best way to authenticate requests

未關閉
#17 7 則留言 5 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
1.3k
分支
139
PR 合併指標
30 天內沒有已合併 PR

描述

I am trying to figure out the best way to authenticate a request before my schema executes the query/mutation. I was thinking I could use the @app.resolver('url') tag and create a function that would authenticate the request and then pass it to the graphqlview. Something like this:
```
@app.route('/graphql/')
def graphql():
print request.headers #AUTHENTICATE HERE
print request.data
return GraphQLView.as_view('/graphql/', schema=schema, graphiql=True)
```
But this doesn't work, can someone either show me what I am doing wrong here or give me a different way to authenticate the request? Thanks!

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Start with the Flask route using @app.route('/graphql/') and the GraphQLView.as_view('/graphql/', schema=schema, graphiql=True) entry point. Trace how the request reaches the schema, then establish an authentication approach that runs before schema execution and verify that unauthenticated requests are rejected.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
flask, graphql, python
領域
api, authentication, backend
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。