# How to authenticate with v8js script?

**URL:** <https://community.dreamfactory.com/t/how-to-authenticate-with-v8js-script/2027>\
**Category:** REST API\
**Created:** [January 12, 2016, 6:39pm UTC](https://community.dreamfactory.com/t/how-to-authenticate-with-v8js-script/2027 "2016-01-12T18:39:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andersonmuller](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@andersonmuller](https://community.dreamfactory.com/u/andersonmuller)\
**Post date:** [January 12, 2016, 6:39pm UTC](https://community.dreamfactory.com/t/how-to-authenticate-with-v8js-script/2027/1 "2016-01-12T18:39:10Z")

</div>

Hi,

How authenticate an dreamfactory user using a server-side script? Its possible?

---

<div class="post-metadata">

**Author:** ![mrjohny](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@mrjohny](https://community.dreamfactory.com/u/mrjohny)\
**Post date:** [January 13, 2016, 2:39pm UTC](https://community.dreamfactory.com/t/how-to-authenticate-with-v8js-script/2027/2 "2016-01-13T14:39:16Z")

</div>

Have look at this post

> [@Custom resource-path](https://community.dreamfactory.com/t/custom-resource-path/1993/8):
>
> Thanks man, for the enlightening examples. Maybe that’s the only way to do what I want, even disliking hahahaha Thanks for you time, u helped alot.

---

<div class="post-metadata">

**Author:** ![andersonmuller](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@andersonmuller](https://community.dreamfactory.com/u/andersonmuller)\
**Post date:** [January 13, 2016, 5:39pm UTC](https://community.dreamfactory.com/t/how-to-authenticate-with-v8js-script/2027/3 "2016-01-13T17:39:17Z")

</div>

Thanks @mrjohny, the link is to our post 😄

I can register a user (user/register), list them (system/user).  
The problem is when i try to authenticate a user (user/session), I get an exception.

I explain the problem here:

> [@Create an user session (login)](https://community.dreamfactory.com/t/create-an-user-session-login/2018):
>
> Hi, I have a Custom Scriping Service and im trying to create an user session, the script is: var my\_payload = {"email":"my@email.com", "password":"mypassword", "duration":"0" }; var result = platform.api.post("user/session", my\_payload); return result; But i receive error 500 and the log shows: exception ‘Symfony\Component\Debug\Exception\FatalErrorException’ with message ‘Call to a member function query() on a non-object’ in …dreamfactory-2.0.2-0/apps/dreamfactory/htdocs/app/Http/Middlew…

_ps. I tried on two different computers with DF2.0.2 and DF2.0.4, and I received the same error_

Thank you!
