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

feat: ACNA-1854 - add getAccessTokenByClientCredentials function #110

Merged
merged 12 commits into from
May 12, 2023

Conversation

shazron
Copy link
Member

@shazron shazron commented Apr 3, 2023

Changes 📦

  • add Ims.getAccessTokenByClientCredentials function -- this is an OAuth call with client credentials grant type, to get an access token.

Pre-requisites 🔖

Pending 🚧

  • Need to update README in this repo
  • revert 49cf310 before merging
  • manual tests pending

How Has This Been Tested? 🔧

  • npm test

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@shazron shazron changed the title feat: ACNA-1854 - add getAccessTokenServerToServer function feat: ACNA-1854 - add getAccessTokenByClientCredentials function Apr 3, 2023
@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #110 (965a935) into master (28711f8) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #110   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          481       487    +6     
  Branches        68        68           
=========================================
+ Hits           481       487    +6     
Impacted Files Coverage Δ
src/ims.js 100.00% <100.00%> (ø)
src/token-helper.js 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@shazron shazron marked this pull request as ready for review April 5, 2023 12:40
src/ims.js Outdated Show resolved Hide resolved
test/ims.test.js Outdated Show resolved Hide resolved
@sandeep-paliwal
Copy link
Contributor

@shazron changes look good. I think we should also update the Readme with example code.

@@ -372,7 +372,7 @@ class Ims {
* {@link toTokenResult} or rejects to an error message.
*/
async getAccessTokenByClientCredentials (clientId, clientSecret, orgId, scopes) {
aioLogger.debug('getAccessTokenServerToServer(%s, %s, %s, %o)', clientId, clientSecret, orgId, scopes = [])
aioLogger.debug('getAccessTokenByClientCredentials(%s, %s, %s, %o)', clientId, clientSecret, orgId, scopes = [])
Copy link

Choose a reason for hiding this comment

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

please don’t log the clientSecret, this is sensitive info like a password

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks -- I'll truncate it to the last n chars.

Copy link
Member Author

Choose a reason for hiding this comment

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

actually this should be ok since we are logging in a debug context only. However it seems that this type of logging is not isolated to just this function, but quite a few functions as well (as well as logging of the tokens, not just secrets). I'll bring this up for dev discussion as a separate issue for resolution: #121

@shazron shazron merged commit 091d8b6 into master May 12, 2023
@shazron shazron deleted the story/ACNA-1854 branch May 12, 2023 00:30
@kwin
Copy link

kwin commented May 23, 2023

@shazron Can we get a release with this soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants