Using Okta session id with REST Api

#1

Hi all,
I would like to access a resource on my company’s site.
When I use a browser I log in via okta widget, then I can access the resource without problems.
I would like to achieve the same thing on a script (no UI).
Using the Okta Rest API I was able to get the sesionToken first with {{url}}/api/v1/authn
and then used it to retrieve the session id with {{url}}/api/v1/sessions
Can I now use the sesion id to set a cookie/header on my requests to get this resource without being redirect to okta widget login page?
I hope I made my point clear.
Thanks in advance
Fran

#2

Hi @fvarela

Unfortunately, you can not use the session id to set the cookie inside the browser. The only way to create a browser session is by using the session token as described here.

#3

Hi dragos,
Thanks for your reply. I will try to implement it as described on that link.