shogo4405 / HaishinKit.swift

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.
BSD 3-Clause "New" or "Revised" License
2.77k stars 614 forks source link

Q: RTMP Authentication #171

Closed oantajames closed 7 years ago

oantajames commented 7 years ago

Hi! I really appreciate all that you are doing on this project. Awesome work! I am currently working on a project that needs RTMP Authentication, but there is no documentation regarding this on the internet. I saw that you implemented it so I took this project as an example. I managed to get the following response from the server : "[ AccessManager.Reject ] : [ code=403 need auth; authmod=adobe ]" From what I have understood from your project the way things go are like this: 1. Make a call to the server with the normal urlrtmp://host[:port]/application/streamName 2. You will receive the following error from the server "[ AccessManager.Reject ] : [ code=403 need auth; authmod=adobe ]" 3. Make a new call with the following urlrtmp://host[:port]/application/streamName?authmod=adobe&user=username 4. You will receive back from the server the following : [ AccessManager.Reject ] : [ authmod=adobe ] : ?reason=needauth&user=100987&salt=NDU=&challenge=NjA4NDEzNzg0 or something like that. 5. With the last response from the server you will build the url that will (hopefully) authenticate you successfully.

My problem is at 4! I never get the salt, challenge and opaque parameters.... I only receive this : "[ AccessManager.Reject ] : [ code=403 need auth; authmod=adobe ]"

Am I doing it in the right way ? Is this rtmp://host[:port]/application/streamName?authmod=adobe&user=username the corect format for the second call ?

Thanks in advance!

James

shogo4405 commented 7 years ago

Is this rtmp://host[:port]/application/streamName?authmod=adobe&user=username the corect format for the second call?

No. RTMP ConnectionPacket doesn't need "streamName". rtmp://host[:port]/application?authmod=adobe&user=username https://github.com/shogo4405/lf.swift/blob/master/Sources/RTMP/RTMPConnection.swift#L353

If you send this uri "rtmp://host[:port]/application/streamName?authmod=adobe&user=username", RTMPServer interprets rtmp://host[:port]/application/appInstanceName?authmod=adobe&user=username

Regards.

oantajames commented 7 years ago

Will try it that way and come back. From what I have remembered I also tried it this way. Will see. Thank you !!!

oantajames commented 7 years ago

Thanks.

shogo4405 commented 7 years ago

Could you please explain in simple terms

I'm not sure. Please ask stackoverflow!

Regards.