okta / okta-auth-js

The official js wrapper around Okta's auth API
Other
455 stars 267 forks source link

Detect origin for urls of different forms #1538

Open inc-osaulenko opened 2 months ago

inc-osaulenko commented 2 months ago

Currently, origin is detected by taking the part of URL prior to /oauth2/ and for URLs like this

https://www.domain.com/oauth2/{some-client-id}

It works as expected. However, when the service that uses OKTA API is behind a multi-tenant proxy and URL will be like

https://www.domain.com/{lang}/{tenant-id}/oauth2/{some-client-id}

It doesn't work. There is an option to do the same thing using (new URL('...')).origin but that will require to add another polyfill for IE11. This one uses Array.prototype.split which is available in IE11 and requires no polyfill.

jaredperreault-okta commented 2 months ago

Thank you for the submission!

Internal Ref: OKTA-805980