Skip to content
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

[SDK-2172] Add SDK metrics to all API calls #659

Merged
merged 5 commits into from
Dec 2, 2020

Conversation

frederikprijck
Copy link
Member

The requests to the /token endpoint did not include the Auth0-Client header, making it harder to pull metrics from our data.

This PR ensures the token endpoint gets added the appropriate header in the following situations:

  • Get a token after LoginWithPopup
  • Get a token after LoginWithRedirect
  • Refreshing a token with a worker
  • Refreshing a token without a worker

@frederikprijck frederikprijck requested a review from a team as a code owner December 1, 2020 15:43
@frederikprijck frederikprijck added the review:small Small review label Dec 1, 2020
Copy link
Contributor

@stevehobbsdev stevehobbsdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just had a minor point around tests.

Comment on lines 193 to 198
'Auth0-Client': btoa(
JSON.stringify({
name: 'auth0-spa-js',
version: version
})
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we're adding coverage here, it would be worth adding the same assertions on the headers for the test that follows ("..when using refresh tokens"). Looks like an omission testing for one but not the other, even though in reality we know both are covered.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ye I thought about it, wasn't sure and decided to not pollute all tests with it. But I think I can add it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR to address this. Also added it on a few more places and used DEFAUKT_AUTH0_CLIENT where appropriate

@frederikprijck frederikprijck merged commit 7a25483 into master Dec 2, 2020
@frederikprijck frederikprijck deleted the frederik/sdk-2172 branch December 2, 2020 13:42
@frederikprijck frederikprijck added this to the vNext milestone Dec 2, 2020
@frederikprijck frederikprijck added the CH: Added PR is adding feature or functionality label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CH: Added PR is adding feature or functionality review:small Small review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants