Is there a credential websocket example? I encountered authentication failure using usip service
Opened this issue · 2 comments
wssnail commented
-
- This is my USIP setup.
# usip about
USIP_ENBALED=true
USIP_URI_CREDENTIAL=http://host.docker.internal:8080/credential
USIP_URI_USERINFO=http://host.docker.internal:8080/userinfo
USIP_URI_ROLE=http://host.docker.internal:8080/role
USIP_URI_COLLABORATORS=http://host.docker.internal:8080/collaborators
-
- Then python-usip was used and the following error occurred
INFO: 127.0.0.1:57956 - "GET /credential HTTP/1.1" 200 OK
INFO: ('127.0.0.1', 57961) - "WebSocket /credential" 403
INFO: connection rejected (403 Forbidden)
INFO: connection closed
-
- To address the above error, I added the route
@app.websocket("/credential")
- To address the above error, I added the route
@app.websocket("/credential")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
await websocket.send_text("{}")
-
- But something went wrong with the universer container.
caller=[/home/runner/work/universer/universer/internal/biz/usip.go:291] service.id=bea0152ad487 service.name=Universer service.version=v0.2.14 trace.id= span.id= user.id= feature.id= msg=[CredentialVerify] json.NewDecoder.Decode err: invalid character 'Á' looking for beginning of value
Whether using websocket.send_text, websocket.send_json
, etc., the above error will occur. How do I handle the authentication of this websocket
?
zsq1234 commented
We found websocket in web only support cookie
header credential, you can use cookie to deal with it, there is a demo but it is golang: https://github.com/dream-num/usip-example/tree/main/go-usip/demo2 . We will give a resulotion for authorization
header in the future.