Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a credential websocket example? I encountered authentication failure using usip service #2

Open
wssnail opened this issue Sep 22, 2024 · 2 comments
Assignees

Comments

@wssnail
Copy link

wssnail commented Sep 22, 2024

    1. 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
    1. 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
    1. To address the above error, I added the route @app.websocket("/credential")
@app.websocket("/credential")
async def websocket_endpoint(websocket: WebSocket):
    await websocket.accept()
    await websocket.send_text("{}")
    1. 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
Copy link
Contributor

zsq1234 commented Sep 27, 2024

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.

@hexf00
Copy link
Member

hexf00 commented Oct 14, 2024

The nodejs demo has been updated to use cookies #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants