Colin-b / requests_auth

Authentication classes to be used with requests
MIT License
35 stars 13 forks source link

I am trying to use requests_auth.OktaAuthorizationCode and can you please get me any example #48

Closed yashcs closed 3 years ago

yashcs commented 4 years ago

I am trying to use requests_auth.OktaAuthorizationCode and can you please get me any example

Colin-b commented 4 years ago

Hi @yashcs,

You will find a sample on the project readme.

import requests
from requests_auth import OktaAuthorizationCode

okta = OktaAuthorizationCode(instance='testserver.okta-emea.com', client_id='54239d18-c68c-4c47-8bdd-ce71ea1d50cd')
requests.get('http://www.example.com', auth=okta)

The parameters are listed right after the Python code sample.

You might have to set the authorization_server parameter if it's not "default" (this is the case in my current company).

If you don't know where to retrieve all those parameters (instance, client_id and authorization_server, ..) I can ask around and come back with more details on where to find them in an OKTA administration page. Do you want me to?

Also note that this module provides OKTA Authorization Code with PKCE, and that is maybe what you are looking for, again you will have to check your OKTA administration page.