# Pre Authentication Process

**URL:** <https://community.dreamfactory.com/t/pre-authentication-process/1172>\
**Category:** Authentication & Security\
**Created:** [June 9, 2015, 2:39pm UTC](https://community.dreamfactory.com/t/pre-authentication-process/1172 "2015-06-09T14:39:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![navjinder](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/navjinder/32/313_2.png) [@navjinder](https://community.dreamfactory.com/u/navjinder)\
**Post date:** [June 9, 2015, 2:39pm UTC](https://community.dreamfactory.com/t/pre-authentication-process/1172/1 "2015-06-09T14:39:31Z")

</div>

Hi There

Right now I am using DSP with an Angularjs app and everything is working fine as the users are checked against the DSP user table but I would like to do the following:

1. User enters the email and password
2. Instead of checking against the DSP user database it should send an http request to a password protected URL which takes in the email and password and returns code 200 if it is good.
3. Then update the password in the DSP account and login in the user using the regular DSP user database credentials.

This is the equivalent code using PHP CURL:

```
$curl = curl_init('https://mail.google.com/mail/feed/atom');
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->params->get('verifypeer', 1));
                curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($curl, CURLOPT_USERPWD, $credentials['username'] . ':' . $credentials['password']);
                curl_exec($curl);
                $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

                switch ($code)
                {
                    case 200:
                        $message = 'ACCESS_GRANTED';
                        $success = 1;
                        break;

                    case 401:
                        $message = 'ACCESS_DENIED';
                        break;     
                                   
                    default:       
                        $message = 'UNKNOWN_ACCESS_DENIED';
                        break;
                }

```

I would really appreciate any help. I am thinking I have to edit the DSP angular-user-module to get the desired results.

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [June 17, 2015, 5:39pm UTC](https://community.dreamfactory.com/t/pre-authentication-process/1172/2 "2015-06-17T17:39:55Z")

</div>

I don’t think adding and then editing the source code of the angular\_dreamfactory\_user\_management\_module should be necessary to accomplish this. You should be able to add a script to POST /user/session that makes the external authentication call, then allows the login to proceed if good, and prevents it if not.

- [Server-side REST event triggers](https://github.com/dreamfactorysoftware/dsp-core/wiki/Server-Side-Events#rest-events)
- [Server-side scripting](https://github.com/dreamfactorysoftware/dsp-core/wiki/Server-Side-Scripting)
- [API access via scripts](https://github.com/dreamfactorysoftware/dsp-core/wiki/API-Access-via-Scripts)

---

<div class="post-metadata">

**Author:** ![navjinder](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/navjinder/32/313_2.png) [@navjinder](https://community.dreamfactory.com/u/navjinder)\
**Post date:** [June 17, 2015, 6:09pm UTC](https://community.dreamfactory.com/t/pre-authentication-process/1172/3 "2015-06-17T18:09:36Z")

</div>

Thanks @jeffreystables

I will give it a try and will post my response when I tackle it.

---

<div class="post-metadata">

**Author:** ![michaelnagy](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/michaelnagy/32/583_2.png) [@michaelnagy](https://community.dreamfactory.com/u/michaelnagy)\
**Post date:** [February 22, 2016, 7:19pm UTC](https://community.dreamfactory.com/t/pre-authentication-process/1172/4 "2016-02-22T19:19:38Z")

</div>

All these links are not working anymore, could you please update it? Thanks

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [March 2, 2016, 6:06pm UTC](https://community.dreamfactory.com/t/pre-authentication-process/1172/5 "2016-03-02T18:06:53Z")

</div>

[https://wiki.dreamfactory.com/DreamFactory/Tutorials#Scripting](https://wiki.dreamfactory.com/DreamFactory/Tutorials#Scripting)

All documentation is now at [https://wiki.dreamfactory.com](https://wiki.dreamfactory.com)
