Skip to content

Conversation

tantara
Copy link

@tantara tantara commented Aug 18, 2025

Summary

Allow authentication via URL parameter as an alternative to HTTP Basic Auth header. This enables authentication in scenarios where headers cannot be easily set.

Background

I'm building a react library react-ttyd to integrate ttyd with react applications. Since browser doesn't allow to update header with WebSocket, I parse and verify credential from url parameters.

Example

ttyd --writable --credential testuser:testpw bash
socket = new WebSocket("http://localhost:7681/ws?authorization=${btoa('testuser:testpw')}", ["tty"]);
curl -X POST "http://localhost:7681/token?authorization=dGVzdHVzZXI6dGVzdHB3"
or 
curl -X POST  -H "Authorization: Basic dGVzdHVzZXI6dGVzdHB3" "http://localhost:7681/token"

claude added 2 commits August 17, 2025 21:32
Allow authentication via URL parameter as an alternative to HTTP Basic Auth header.
This enables authentication in scenarios where headers cannot be easily set.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Correct the return value check for lws_get_urlarg_by_name to properly
detect when the parameter is present.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants