When I login with the widget and then run the curl command via PHP to “https://${yourOktaDomain}/api/v1/users/me” I expect to get the logged in users data, instead I am getting a generic account user (assuming it’s the user linked to the API token)
Is there a way to get the logged in users information without waiting on the widget to return it via JavaScript? (which waits until the page is loaded)
Currently I am making an AJAX call to another page AFTER the page fully loads to set the user session, but that requires another refresh after session is set
I understand that, but I am trying to fetch the logged in user, not knowing those yet, once I have them I can get that information with those calls, yes, and when I get it for the first time I put that information into my _SESSION variable. But the first time I need to get his information, I need to wait until the JS function runs, which is after the page is fully loaded, so a delay.
Nobody can assist with a faster way of getting the “logged in user” than using the javascript code when logging in via the javascript widget? a PHP solution that could fire as the page loads, instead of waiting on the javascript to run would be much better
WIthout a bridge between the front-end and back-end channels in your application, PHP will not be able to know that a user logged in through the sign-in widget.
This bridge can consist in one of the following:
AJAX call to grab the username from /api/v1/username/me from the browser or local storage and send it to the back-end in a query parameter
define processCreds to grab the username before it’s sent to /api/v1/authn (this requires a check on the back-end that the user actually logged in by checking System Logs, note that a race condition might apply here if implemented incorrectly)
I am currently using an ajax call on page load, I tried running the ajax call every 10 seconds, but it ended up logging me out (possibly wouldn’t if I pushed it to a minute? does the system think I am spamming it?)I wasnt actually running the OktaSignIn function with my timer
I was hoping I could run the /me/ using php, but it returns generic values. Is there anything I can do in PHP using the $_COOKIE that is set by Okta and the Okta API?