Put a login in front of your Eagle 3D Streaming stream, so only the people you choose can reach it. The pattern is the same for the Web SDK and the iframe: check the login on your server first, and only then give the page what it needs to start the stream.
src, or calls e3ds_controller.main().| iframe | Web SDK | |
|---|---|---|
| What the page receives after a correct login | The streaming URL | A session token |
| Can a signed-in viewer pass it on? | Yes — the URL keeps working for anyone who has it | No — the token is single use and expires within a minute |
| Streaming API key | Not used | Stays on your server; never sent to the browser |
| Can you cut off one person? | Only by changing the link for everyone | Yes — stop issuing them tokens |
| Good for | Keeping a link away from people who have not signed in | Per-person access that survives someone reading your page source |
With an iframe the link itself is what grants access, so a login protects the link until someone who has signed in shares it. If that matters, add Password Protect Stream on the configuration as a second lock, or use the Web SDK, where your server decides who gets a token, when, and for which app. API keys and session tokens covers what each credential is and how long it lives.
Both demo repositories have a login-example branch with the
smallest version of this that is still built the right way: a Node.js server
(Node 18 or newer, no packages to install) that keeps the users in a JSON file
on the server and answers the login.
| iframe | Web SDK | |
|---|---|---|
| Repository | E3DS-Iframe-Demo, branch login-example |
pixelstreaming-sdk, branch login-example |
| On a correct login the server returns | { ok: true, streamUrl } | { ok: true, tokenData, client } — it asks Eagle for the token itself |
| The page then | sets iframe.src = streamUrl | calls e3ds_controller.main({ ...tokenData, client }) |
Your settings (copy config.example.json to config.json) | the streaming URL | your Streaming API key and which app to start |
git clone -b login-example https://github.com/e3ds/E3DS-Iframe-Demo.git
cd E3DS-Iframe-Demo
node login/server.js
# open http://localhost:3000 and sign in as demo / demo123
For the Web SDK version, clone pixelstreaming-sdk the same way,
copy login/config.example.json to login/config.json
and put your Streaming API key and app in it first.
// The page sends what the visitor typed to YOUR server ...
const response = await fetch('/api/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password })
});
const answer = await response.json();
// ... and only a correct login comes back with something to start the stream.
if (answer.ok) {
document.getElementById('streamFrame').src = answer.streamUrl; // iframe
// e3ds_controller.main({ ...answer.tokenData, client: answer.client }); // Web SDK
}
login/users.json. Passwords
are stored as salted hashes, never as text; add or change one with
node login/add-user.js <username> <password>.Last updated