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

How to implement authentication by placing the srs3.0 token parameter after the streamID? #1110

Closed
Ccrazyfish opened this issue Apr 8, 2018 · 8 comments
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@Ccrazyfish
Copy link

Ccrazyfish commented Apr 8, 2018

The 'token' parameter of srs3.0 is placed after the StreamID. In the TcURL of http_hook, this token is not present. It is only present in the TcUrl when placed after 'live'.
How can I retrieve the token in the 'json_req' of server.py for authentication?
Push stream rtmp://test.lsspush.test.com/live/steam001?key=123000000000&t=20000.
on_connect
json_req:
{u'ip': u'192.168.0.101, u'app': u'live', u'vhost': u'defaultVhost', u'pageUrl': u'', u'client_id': 108, u'tcUrl': u'rtmp://test.lsspush.test.com/live', u'action': u'on_connect'}

on_publish
json_req:
{u'stream': u'steam001', u'ip': u'116.62.38.168', u'app': u'live', u'vhost': u'defaultVhost', u'client_id': 108, u'tcUrl': u'rtmp://test.lsspush.test.com/live', u'action': u'on_publish'}

TRANS_BY_GPT3

@wnpllrzodiac
Copy link
Contributor

2.0 branch have support this feature. You can look up changelog.

@Ccrazyfish
Copy link
Author

Ccrazyfish commented Apr 12, 2018

2.0branch tried it, got the streamID, but there are no parameters with key=** in the hook information.

Push stream address:
rtmp://172.16.162.16/live/stream000?key=123435

Hook information:
action: {u'ip': u'172.16.162.190', u'app': u'live', u'vhost': u'defaultVhost', u'pageUrl': u'',
u'client_id': 120, u'tcUrl': u'rtmp://172.16.162.16', u'action': u'on_connect'}

{u'stream': u'stream000', u'ip': u'172.16.162.190', u'app': u'live', u'vhost': u'defaultVhost',
u'client_id': 120, u'tcUrl': u'rtmp://172.16.162.16', u'action': u'on_publish'}

TRANS_BY_GPT3

@wnpllrzodiac
Copy link
Contributor

wnpllrzodiac commented Apr 12, 2018

Just add a field to the code of 'hook', I modified the source code myself. Winlin has completed 99% of it, so you just need to make the remaining changes yourself. Alternatively, you can create an issue and ask him to fix it.

TRANS_BY_GPT3

@winlinvip winlinvip added the Bug It might be a bug. label Aug 4, 2018
@winlinvip winlinvip added this to the srs 2.0 release milestone Aug 4, 2018
@winlinvip
Copy link
Member

winlinvip commented Aug 4, 2018

SRS2:

{"action":"on_publish","client_id":107,"ip":"127.0.0.1","vhost":"__defaultVhost__",
"app":"live","tcUrl":"rtmp://127.0.0.1:1935/live","stream":"livestream","param":"?userid=123456&token=ueieww"}
{"action":"on_play","client_id":107,"ip":"127.0.0.1","vhost":"__defaultVhost__",
"app":"live","stream":"livestream","param":"?userid=123456&token=ueieww","pageUrl":""}

Support params in on_publish, on_unpublish, on_play, on_stop, on_dvr, on_hls and on_hls_notify.

@winlinvip
Copy link
Member

winlinvip commented Aug 4, 2018

SRS3:

{"action":"on_play","client_id":106,"ip":"::ffff:127.0.0.1","vhost":"__defaultVhost__",
"app":"live","pageUrl":"","stream":"livestream","param":"userid=123456&token=ueieww"}
{"action":"on_publish","client_id":108,"ip":"::ffff:127.0.0.1","vhost":"__defaultVhost__",
"app":"live","tcUrl":"rtmp://127.0.0.1:1935/live","stream":"livestream","param":"userid=123456&token=ueieww"}

Support params in on_publish, on_unpublish, on_play, on_stop, on_dvr, on_hls and on_hls_notify.

@itmanlee
Copy link

itmanlee commented Jul 7, 2022

image
Hello, I would like to ask you two questions. Please refer to the screenshot.

TRANS_BY_GPT3

@itmanlee
Copy link

itmanlee commented Jul 7, 2022

In addition, the JSON data structure received by the proxy here is also somewhat different from the description in the http-hooks of full.conf. Do we need to adjust it ourselves in the source code to match the desired data structure?

TRANS_BY_GPT3

@itmanlee
Copy link

itmanlee commented Jul 7, 2022

image

@winlinvip winlinvip changed the title srs3.0 token参数放在streamID后面如何实现认证 How to implement authentication by placing the srs3.0 token parameter after the streamID? Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

4 participants