
40laq (40laq) asked a question.
Hello All,
I need to verify whether the current user is eligible to access certain part of the my web application or not. it's very easy to identify on front-end with "api/v1/sessions/me" to check for active session and user detail if user is logged in with Okta UI. same thing I need to do with Python Script. how I can achieve this?
I can send session id to Python API which i i'm retrieving from "api/v1/sessions/me", how can i further verify that SessionId is active or not.
I'm trying to use following End Point using Python Requests module, which is not working and gives me same error all time.
"api/v1/sessions/${session_id}"
{
"errorCode": "E0000005",
"errorSummary": "Invalid session",
"errorLink": "E0000005",
"errorId": "oae2L4YpvK5StWbHnl0v_p5lA",
"errorCauses": []
}
Is there a way to verify Session is active or not for given Session ID from "api/v1/sessions/me".
Reference : https://developer.okta.com/docs/reference/api/sessions/*get-current-session

Hello @40laq (40laq)
Thanks for posting.
In regards to the error E0000005 here is an explanation:
https://support.okta.com/help/s/article/Reactivate-User-API-call-returning-error-E0000005?language=en_US
These projects will help you with the Python API on Okta:
https://github.com/okta/okta-sdk-python
https://stackoverflow.com/questions/70479610/python-api-request-to-internal-api-with-okta-authentication
https://serveanswer.com/questions/python-api-request-to-internal-api-with-okta-authentication
For more specific details applied to your specific use case feel free to post this question on our Okta Developer Forums: https://devforum.okta.com, this is a place for the Okta developer community to interact.
Let us know if this helps you.
Daniela Chavarria.
Okta Inc.