
ArvS.21281 (Customer) asked a question.
I am looking for a way to determine Okta user name for person accessing a custom web page for purposes of then using that Okta username and email address to fill some form fields automatically. The API "api/v1/users/me" seemed at first to address this use case, but then I see in the documentation that it will return the user associated with the api_key rather than the user who is coming to that web page. Is there some way to satisfy this use case?

Hello @ArvS.21281 (Customer) Thank you for reacting out to our Community!
For this you might want to use the "Get current user" functionality form the documentation below, this should be what you are looking for:
https://developer.okta.com/docs/reference/api/users/#get-current-user
Community members help others by clicking Like or Select as Best on responses. Try it today.
Hmmm... I am seeing that requires a session cookie? (or is that optional???) If not optional, then next question is how can lookup current session cookie programmatically from within the browser script? I am not seeing it in the document.cookies collection.
curl -v -X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Cookie: ${okta_session_cookie}" \
"https://${yourOktaDomain}/api/v1/users/me"
Hi,
Is your custom page protected by OKTA ? what type of app is it SPA/Web ? are you using OIDC - in that case you have the ID token, you should have username and email in ID token already. Could you elaborate more on what you are trying to achieve with example of the domain names of both okta and your custom web page (to see if they are same domain or cross domain)
Thanks
Tushar Vatsa