How to get id_tokens in Okta without a browser using python


I was wanted to get the id_token from Okta. So I googled and found an article →

How to get tokens for an OIDC application without a browser using curl/Postman (

It worked for me and got the id_token through postman. But, when I implemented the same flow in python the authorize step returned following response:

<input type="hidden" name="error" value="access_denied"/>
<input type="hidden" name="error_description" value="The resource owner or authorization server denied the request."/>

I tried everything but couldn’t find the solution. Please help me.