Skip to content

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

Closed

Description

@Ccrazyfish

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

Activity

  1. wnpllrzodiac commented on Apr 10, 2018

    @wnpllrzodiac
    Contributor

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

  2. Ccrazyfish commented on Apr 12, 2018

    @Ccrazyfish
    Author

    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

  3. wnpllrzodiac commented on Apr 12, 2018

    @wnpllrzodiac
    Contributor

    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

  4. added this to the srs 2.0 release milestone on Aug 4, 2018
  5. winlinvip commented on Aug 4, 2018

    @winlinvip
    Member

    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.

  6. added a commit that references this issue on Aug 4, 2018
  7. winlinvip commented on Aug 4, 2018

    @winlinvip
    Member

    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.

  8. added 2 commits that reference this issue on Aug 4, 2018
  9. added 4 commits that reference this issue on Aug 5, 2018
  10. self-assigned this
    on Sep 12, 2021
  11. itmanlee commented on Jul 7, 2022

    @itmanlee

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

    TRANS_BY_GPT3

  12. itmanlee commented on Jul 7, 2022

    @itmanlee

    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

  13. itmanlee commented on Jul 7, 2022

    @itmanlee

    image

  14. changed the title [-]srs3.0 token参数放在streamID后面如何实现认证[/-] [+]How to implement authentication by placing the srs3.0 token parameter after the streamID?[/+] on Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugIt might be a bug.TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions