-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow user agent to be modified #98
Conversation
@@ -56,6 +56,8 @@ function OktaAuthBuilder(args) { | |||
headers: args.headers | |||
}; | |||
|
|||
this.userAgent = 'okta-auth-js-' + config.SDK_VERSION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of assigning it here, would it make sense to push this over to our config object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why we're making this an accessible property as opposed to concatenating the passed user agent during object construction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While our current use case is concatenation to achieve a prepend, I don't want to limit us to that behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this implementation force user-agent overrides though? Someone can rewrite our custom user agents by forgetting to append the authJS.userAgent
value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already possible to overwrite the entire user agent with this construction:
new OktaAuth({
headers: {
'X-Okta-User-Agent': 'foo'
}
});
What we need is a way for this library to expose what it's "default" user agent is, so that the consuming library can include that default user agent in it's intended re-write of the user agent. That's what this PR attempts to do. Enforcing a default user agent substring is out of scope, and IMO a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. 👍
65d599a
to
535a283
Compare
This allows other libraries to prefix the user agent, rather than overwriting it entirely with passed options
This allows other libraries to prefix the user agent, rather than overwriting it entirely with passed options.
Part of resolving OKTA-158252