Get user ID when user register


I’ve been struggling for getting User ID after user successfully register. I have tried using $platform[‘session’][‘user’][‘id’] but it always come back null (or 0). Is there any way we can get user ID in the register post.process server-side script?



I’m assuming you’re using DF user ID as a primary key in some other DB to store user specific data?

I just made a pull request to put an example on the offical DF GitHub repository, but sometimes they are kind of slow to merge.

You can see it here:


Hello zerox12,
Thank you for help. You are right; I need to duplicate user information to another database. I’ve just almost given up and back using (only) laravel to create a web service until I saw your post. I’ve translated your code using PHP, and it works perfectly.

here is my code, hopefully, it could help someone out there who have the same problem.


$options = [];
$options['headers'] = [];
$options['headers']['X-DreamFactory-Api-Key'] = $platform['session']['api_key'];
$options['headers']['X-DreamFactory-Session-Token'] = $platform['session']['session_token'];
$options['headers']['Content-Type'] = 'application/json';

$api = $platform["api"];
$get = $api->get;
$url = 'user/session';
$result = $get($url);

$id = $result['content']['id'];
echo "id:".$id;