User-Agent in Okta SSO Header API

try:
response = requests.post(
_getokta_url() + ‘/api/v1/users/%s/factors/%s/verify’ % (
user_id, factor_id),
headers={
‘Accept’: ‘application/json’,
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘SSWS %s’ % settings.app.sso_okta_token,
‘X-Forwarded-For’: remote_ip,
},
json=verify_data,

Currently, the Okta.py module for sso does not include the user-agent header. This leaves important context data out of the push notification. Can we add a line here in the headers? Here is the Okta link mentioning the support for that: Factors | Okta Developer

1 Like

This will be fixed in the next release.

Awesome, thanks @zach – when do you expect the next release?

The v1.32 contains major changes and isn’t expected for several more weeks.

All good, thanks @zach – if you need help testing or working on that code, please let me know. Keen to get involved in an open-source project.

Hey @zach – I just upgraded to v1.32.3487.33 and the header still doesn’t show on push. Attaching a screenshot.

From this Okta article it looks like it wants a very specific string:

We recommend that you use a template like the following to format the User-Agent string:

User-Agent: Mozilla/5.0 (<system-information>) <platform> (<platform-details>) <extensions>

The next release will include the connecting users platform.

Thanks @zach !

@harrisonjohn did it work for you?
I manually modified get_user_id function to insert 'User-Agent': 'Mozilla/5.0 (Python 3.9) Pritunl/1.32' header, but the push screen still doesn’t show this info (I did restart pritunl server).

@fmalykh – The latest version released of Pritunl 1.32.3498.90 covers this off and works well. Okta requires a very specific format to parse this. Read more here.

I set user-agent from master branch here:

Still looks to be in an incorrect format. Try something like this:

Mozilla/5.0 (%sPython 3.9) Pritunl/1.32' % Macintosh