<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z000092wYlWCAUOkta Classic EngineAPI Access ManagementAnswered2024-03-08T21:12:10.000Z2023-04-10T12:51:06.000Z2023-04-12T18:03:19.000Z

ArvS.21281 (Customer) asked a question.

Lookup Current User's Okta Username From Browser Script

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?


  • ArvS.21281 (Customer)

    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"

     

     

     

    Expand Post
  • TusharV.35363 (Customer)

    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

    Expand Post
This question is closed.
Loading
Lookup Current User's Okta Username From Browser Script