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

Client Side Authentication Issue #9585

Closed
zhenlan opened this issue Jun 17, 2020 · 9 comments
Closed

Client Side Authentication Issue #9585

zhenlan opened this issue Jun 17, 2020 · 9 comments

Comments

@zhenlan
Copy link

@zhenlan zhenlan commented Jun 17, 2020

@jasongaylord commented on Wed Jun 17 2020

It seems as though something has changed in the AppConfigCredential.signRequest method. Here's what I have:

  • The NPM package @azure/app-configuration version 1.0.1
  • Using TypeScript
  • Connecting using const client = new AppConfigurationClient('<connection string>');

In the logs, I'm seeing the following:

core.js:6228 ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
    at AppConfigCredential.signRequest (appConfigCredential.js:23)
    at SigningPolicy.push../node_modules/@azure/core-http/es/src/policies/signingPolicy.js.SigningPolicy.signRequest (signingPolicy.js:20)
    at SigningPolicy.push../node_modules/@azure/core-http/es/src/policies/signingPolicy.js.SigningPolicy.sendRequest (signingPolicy.js:24)
    at GenerateClientRequestIdPolicy.push../node_modules/@azure/core-http/es/src/policies/generateClientRequestIdPolicy.js.GenerateClientRequestIdPolicy.sendRequest (generateClientRequestIdPolicy.js:24)
@jasongaylord
Copy link

@jasongaylord jasongaylord commented Jun 18, 2020

Thanks for moving it here @zhenlan

@richardpark-msft
Copy link
Member

@richardpark-msft richardpark-msft commented Jun 19, 2020

Thank you for notifying us. I'll be looking at this.

@jasongaylord
Copy link

@jasongaylord jasongaylord commented Jun 19, 2020

Thank you for notifying us. I'll be looking at this.

If you'd like me to test out a fix, let me know. I have a prototype ready to go.

@richardpark-msft
Copy link
Member

@richardpark-msft richardpark-msft commented Jun 19, 2020

Hi @jasongaylord, I'm not able to reproduce this (at least, not with my out-of-the-box sample).

Do you mind sharing a small sample app that demonstrates this problem? I'm wondering if I'm missing a combination of dependencies.

I've uploaded my sample app to see if it helps us narrow things down:
https://github.com/richardpark-msft/samples/tree/master/9585

@jasongaylord
Copy link

@jasongaylord jasongaylord commented Jun 19, 2020

https://github.com/jasongaylord/AngularAzureFeatureFlag/tree/Complete/src/app

Really, the showAboutMeFeature.ts file is where I planned on doing most of the work. It's used in the main component.

@jasongaylord
Copy link

@jasongaylord jasongaylord commented Jun 20, 2020

@richardpark-msft Not sure if you noticed my post above ^^^

@richardpark-msft
Copy link
Member

@richardpark-msft richardpark-msft commented Jun 22, 2020

@jasongaylord - just an update - I believe I found a fix for this. Your sample app was a HUGE help, thank you for posting it.

The crux of the issue is that AppConfig uses the node crypto package. The error you've got above is because we're attempting to call createHash which is coming back undefined (crypto is being stubbed out).

I've got a tentative fix in PR #9648 where we use the WebCrypto APIs when in the browser. Some of the critical reviewers are out of office at the moment so there will be a delay but I will keep you updated as it moves through.

@jasongaylord
Copy link

@jasongaylord jasongaylord commented Jun 23, 2020

@richardpark-msft Thanks for your assistance. I saw that one of the reviewers have responded to PR #9648 . In case others run into this, I blogged about it at https://jasong.us/3ev93nQ. I'll update my post once the fix is merged and GA.

richardpark-msft added a commit that referenced this issue Jun 25, 2020
…wsers. (#9648)

Our usage of the `crypto` package in appconfig causes an issue in browsers.

This adds functions to hash and hmac  that use the appropriate implementation for browser (WebCrypto) and the node.js crypto package for node.

Fixes #9585
@richardpark-msft
Copy link
Member

@richardpark-msft richardpark-msft commented Jun 26, 2020

@jasongaylord - happy Friday :)

The PR has been approved and we a have a nightly build available with the fix you'd like to try it early:
https://www.npmjs.com/package/@azure/app-configuration/v/1.1.0-dev.20200625.2

The GA fix will be released with our normal monthly cadence (the first week of each month).

Thank you for reporting this issue - really appreciated working with you.

sadasant added a commit to sadasant/azure-sdk-for-js that referenced this issue Jun 27, 2020
…wsers. (Azure#9648)

Our usage of the `crypto` package in appconfig causes an issue in browsers.

This adds functions to hash and hmac  that use the appropriate implementation for browser (WebCrypto) and the node.js crypto package for node.

Fixes Azure#9585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.