Build with IDX Broker › Forums › API › API PHP › Automatically logging in the user after they sign up
Tagged: api
-
AuthorPosts
-
-
Hello,
I have developed a custom sign up form which collects the user’s Name, Address, Zip Code, Email, and Phone. I have successfully written PHP code using:
https://middleware.idxbroker.com/docs/api/methods/index.html#api-Leads-putLead
which puts a new Lead into the IDXBroker system.
After they are put into the system, they are directed to the IDX search results page. What I need to do is automatically log the user in after they have been submitted as a new Lead into the system. Is their a way in the IDXBroker API to automatically log a lead in to the system?
Thank you for your assistance.
(0 rating, 0 votes, rated)
You need to be a registered member to rate this post.Loading... -
There is no way via the API to log someone in. That would have to happen in the browser.
(0 rating, 0 votes, rated)
You need to be a registered member to rate this post.Loading...-
@AnthonyOrtega, Thx for the response, I’m getting an error still but I think it is possible by sending a POST request to the IDX Login URL. I inspected the User Login Form and it shows the IDX Login URL:
//www.dsmhousesearch.idxbroker.com/idx/ajax/userlogin.php
What I did was copy and paste the entire form and put it in my Global Header Wrapper HTML, hiding it on the page using CSS. I then used jQuery to replace the email field with the correct email of the user. Then in my custom.js file from my server which is also being pulled from the Global Header Wrapper HTML, I put this code:
jQuery.post("/idx/ajax/userlogin.php", jQuery("#IDX-loginForm").serialize(), function(data)
{
// success after the user is logged in above
console.log(data);
});
However after inspecting the console from the browser, I got this error:
{"error":"n","leadID":"25931","redirectLink":"\/idx\/results\/listings?city%5B0%5D=943&pt=sfr&sfrType%5B0%5D=Residential&srt=DESC&stp=advanced&start=1&per=10"}
(0 rating, 0 votes, rated)
You need to be a registered member to rate this post.Loading...
-
-
From my above code, I was able to log the user in. But after making the POST request to the IDX Login URL, I had to refresh the page for them to be logged in.
(0 rating, 0 votes, rated)
You need to be a registered member to rate this post.Loading...
-
-
AuthorPosts
- You must be logged in to reply to this topic.