-
Notifications
You must be signed in to change notification settings - Fork 87
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
Authentication with webhooks and example authentication-backend #194
base: main
Are you sure you want to change the base?
Conversation
Oh hell yea! This is amazing, you rock @neilschark I will give input tonight. Just getting off a flight and excited to see this :) |
This looks like much needed feature … I will try it out .. thanks @neilschark for working on this . Doing it with pocketbase is a good idea since it has so many integrated auth providers. @Sean-Der I guess you got side tracked ? If you have any review comments it would be good to hear it :) |
… via another backend
0f25406
to
2a470ac
Compare
Thank you for this . Will test and feedback .. For dynamic scripting between golang frontend and PB I am using benthos these days too. It’s as you know also written in golang and can also be embedded if wanted. it’s a new trick I have gotten into . I use it to manage data in and out of OB but also other systems . It’s kind of a service mesh. I will test and then if you want can discuss in another issue for use cases |
I worked a bit more on the issue and the authentication works know, but I have the problem, that streaming from OBS is stopped with an generic error after around 10 seconds. I will try to get some more log output in the near future to continue the work. |
@neilschark this PR is perfect. My lack of feedback is just busy from work. Im going to merge this weekend! What do you think of having That way you can independently develop and iterate and not be blocked on me. This also keep broadcast box small. |
@Sean-Der no worries, This is a side project and everyone knows that that unfortunately has always to be prioritized low. It's your project, if you want to have the authentication just as a separate project, that's fine by me. Just the webhook functionality has to be merged regardless. |
Hey all, I am also wanting to set this up with some auth. In my case I will hook it up with Pocketable for easy auth. |
41fdca3
to
358361c
Compare
As discussed, I created an PR with only the webhook implementation here: #224 It is mostly the implementation by https://github.com/mpisat. I will create a different project with a sort of "reference" implementation with pocketbase, as I initially planned to do in this project. From my point of view this PR can be closed. |
Hello,
This is currently just a draft and not finished, but I am at a point where I think we should discuss the idea and implementation!
Background
as discussed in #140 there is the need for only allowing some people to stream to the server. A good solution was also proposed by https://github.com/mpisat: webhooks.
They also wrote some code in their own fork, but never opened a PR.
So I took the liberty of using their code as a base but also add an example/reference implementation of a authentication-backend, so that the project can deliver it for users to use.
Plan
The plan is, that each user has a username and also a streamkey. If they want to stream, the have to provide their token as a bearer token e.g.:
If their token matches a user (their user hopefully 😉 ) the stream gets accepted. For viewers to watch they can now go to
server/$username
to watch the stream for this user. Authentication for viewers is currently NOT intended, but could be implemented in a similar way very easily in the future, as far as I understand the code.Current Implementation in this PR
What I have done: I used pocketbase (https://pocketbase.io/) as it offers an easy way of building a REST-API in go. For starters we just need users, streamkeys and some permissions on the endpoints and that's it. Pocketbase offers an easy way of doing this and you can also add tons of SSO options for log in, so each administrator of a broadcast-box could easily add the providers of its choice.
Currently I only created the database schema and an custom internal endpoint for the webhook. The permissions are also still missing.
I currently have to problem that I can not fully test the changes, as the local dev environment is not working for me (doesn't work on the main branch either), as the frontend refuses to display any video and shows the following error:
ERROR The fetching process for the media resource was aborted by the user agent at the user's request.
Could anyone help me, how to get it to work? I followed this documentation for local testing: https://github.com/Glimesh/broadcast-box/blob/main/CONTRIBUTING.md
Any feedback for the current plan and help is appreciated!