# User Authentication

**URL:** <https://community.wowza.com/t/user-authentication/113>\
**Category:** Wowza Streaming Engine\
**Created:** [May 6, 2007, 11:35pm UTC](https://community.wowza.com/t/user-authentication/113 "2007-05-06T23:35:08Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![Michael\_Eldridge](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Michael\_Eldridge](https://community.wowza.com/u/Michael_Eldridge)\
**Post date:** [May 21, 2007, 9:10am UTC](https://community.wowza.com/t/user-authentication/113/21 "2007-05-21T09:10:55Z")

</div>

I too would like to authenticate users from a MySQL database in addition to adding an entry to a table when a video is done recording. Thanks for posting your example code. Question. How are the user credentials passed to WMS? Can they be passed from a flash object? PHP? Are there some docs I can study to get an idea of the communication between Flash and WMS?

---

<div class="post-metadata">

**Author:** ![Hasham\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Hasham\_Ahmad](https://community.wowza.com/u/Hasham_Ahmad)\
**Post date:** [June 5, 2007, 9:11am UTC](https://community.wowza.com/t/user-authentication/113/22 "2007-06-05T09:11:47Z")

</div>

Hello, i have used these examples to port an existing FMS system and setup server-side authetication on Wowza however i get a java.lang.reflect.InvocationTargetException error and the connection is always accepted. There is no further information that i can get out of this to help me debug. Do you have any advice on this?

thanks

Hash

---

<div class="post-metadata">

**Author:** ![Hasham\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Hasham\_Ahmad](https://community.wowza.com/u/Hasham_Ahmad)\
**Post date:** [June 5, 2007, 1:21pm UTC](https://community.wowza.com/t/user-authentication/113/23 "2007-06-05T13:21:32Z")

</div>

Ok thanks for the info. Instead of actually sending a username and password i wanted to modify the function to receive a single session\_id token.

```auto
nc.connect(serverUrl,_root.token)

```

and in the module

```auto
...
static public void onConnect(IClient client, RequestFunction function, AMFDataList params) 
	{
	String token = getParamString(params, PARAM1);
	//String password = getParamString(params, PARAM2);
...

```

The idea being that the login is done independently and a live session table is looked up to make sure that only active and authorised sessions can access the streams.

Can you see where the error might be?

thanks

Hash

---

<div class="post-metadata">

**Author:** ![Hasham\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Hasham\_Ahmad](https://community.wowza.com/u/Hasham_Ahmad)\
**Post date:** [June 6, 2007, 8:47am UTC](https://community.wowza.com/t/user-authentication/113/24 "2007-06-06T08:47:19Z")

</div>

Hi i’ve worked through this issue but now i have a strange problem.

Regardless of whether the sql result leads to an acceptConnection or rejectConnection (which i added as an else condition), the flash client is still able to stream. How do i ensure that the client cannot stream if the connection is not authorised?

Log as follows:

```auto
INFO session connect-pending 125.54.xxx.xxx -
INFO server comment - Reject Connection (I added this)
INFO server comment - onConnect: 86830892
INFO server comment - onConnect: false
INFO session connect 125.54.xxx.xxx -
INFO server comment - onConnectAccept: 86830892
INFO stream create - -

```

AutoAccept is set to false on server and application.

thanks

Hash

---

<div class="post-metadata">

**Author:** ![Hasham\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Hasham\_Ahmad](https://community.wowza.com/u/Hasham_Ahmad)\
**Post date:** [June 8, 2007, 1:44am UTC](https://community.wowza.com/t/user-authentication/113/25 "2007-06-08T01:44:22Z")

</div>

Hi i have tested using the method described above and it still accepts the connection. Note that i have Wowza running on port 1936 for testing.

Log as follows:

```auto
INFO application app-start _definst_ -
INFO session connect-pending 125.54.xxx.xxx -
INFO server comment - onConnect: false
INFO session connect 125.54.xxx.xxx -
INFO server comment - onConnectAccept: 581738787

```

and here is the code in the flash client

```auto
nc.onStatus = function(info) {
	trace("Level: "+info.level+" Code: "+info.code);
	if (info.code == "NetConnection.Connect.Success") {
		trace("--- connected to: " + this.uri);
                          //do something
	} else if (info.code == "NetConnection.Connect.Rejected") {
		//do something
	}
};

```

Please advise on what might be going wrong.

Thanks

Hash

---

<div class="post-metadata">

**Author:** ![Hasham\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Hasham\_Ahmad](https://community.wowza.com/u/Hasham_Ahmad)\
**Post date:** [June 8, 2007, 11:02am UTC](https://community.wowza.com/t/user-authentication/113/26 "2007-06-08T11:02:46Z")

</div>

Yes the code is being executed because the log indicates so. Unfortunately it failed again:

```auto
INFO session connect-pending 125.54.xxx.xxx -
INFO server comment - REJECT
INFO server comment - onConnect: false
INFO session connect 125.54.xxx.xxx -

```

and the Flash client info.code response is as before

```auto
Level: status Code: NetConnection.Connect.Success

```

Note also that we have to have FMS running on port 1935 at the moment but i can’t imagine how that could interfere.

thanks

Hash

---

<div class="post-metadata">

**Author:** ![Hasham\_Ahmad](https://avatars.discourse-cdn.com/v4/letter/h/dc4da7/32.png) [@Hasham\_Ahmad](https://community.wowza.com/u/Hasham_Ahmad)\
**Post date:** [June 9, 2007, 3:10am UTC](https://community.wowza.com/t/user-authentication/113/27 "2007-06-09T03:10:05Z")

</div>

Hi you are absolutely right, i was calling the bwcheck module after the authentication module. I reordered the module list and the connection is being rejected as expected.

Thanks for the support.

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [September 2, 2008, 12:49pm UTC](https://community.wowza.com/t/user-authentication/113/28 "2008-09-02T12:49:02Z")

</div>

It looks like the problem is missing user table:

> ERROR server comment - sqlexecuteException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: Table ‘test.users’ doesn’t exist
> 
> Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [September 4, 2008, 11:18am UTC](https://community.wowza.com/t/user-authentication/113/29 "2008-09-04T11:18:53Z")

</div>

Send user name and password to Wowza when you connect. Assuming you have text boxes named username and pwd, it would look something like this:

```auto
var nc:NetConnection;
nc.connect("rtmp://localhost/simplevideostreaming", username.text, pwd.text)

```

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [September 4, 2008, 1:15pm UTC](https://community.wowza.com/t/user-authentication/113/30 "2008-09-04T13:15:07Z")

</div>

Can you post some of the code you are working on? Show the server-side and how you are invoking that on the client.

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [September 5, 2008, 1:05pm UTC](https://community.wowza.com/t/user-authentication/113/31 "2008-09-05T13:05:46Z")

</div>

Those logs and traces are good on client and server, you are connected.

ObjectEncoding AMF0 is unnecessary, but no problem is indicated.

---

<div class="post-metadata">

**Author:** ![Glen\_Lumanau](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@Glen\_Lumanau](https://community.wowza.com/u/Glen_Lumanau)\
**Post date:** [September 2, 2008, 6:02am UTC](https://community.wowza.com/t/user-authentication/113/32 "2008-09-02T06:02:18Z")

</div>

…

---

<div class="post-metadata">

**Author:** ![Lester\_Fajardo](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@Lester\_Fajardo](https://community.wowza.com/u/Lester_Fajardo)\
**Post date:** [October 7, 2008, 4:32pm UTC](https://community.wowza.com/t/user-authentication/113/33 "2008-10-07T16:32:13Z")

</div>

Hello.

Can somebody of you upload a sample of a flash file to connect to wowza using the mysql module published here ?

Thanks.

Lester

> Send user name and password to Wowza when you connect. Assuming you have text boxes named username and pwd, it would look something like this:
> 
> ```auto
> var nc:NetConnection;
> nc.connect("rtmp://localhost/simplevideostreaming", username.text, pwd.text)
> 
> ```
> 
> Richard

[Previous page](https://community.wowza.com/t/user-authentication/113.md?page=1)
