-
Notifications
You must be signed in to change notification settings - Fork 231
Window is not defined #307
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
Comments
the flow here works for browser but does not work for node since msal does not currently support the credential flows needed for client. For node you'd need to handle the authentication portion. see this PR for how someone recently implemented auth on node. https://github.com/Huachao/vscode-restclient/pull/649/files#diff-24da39a94536877488c5fa835c5212dd //cc @nikithauc |
@ddyett Is there no plan to have even some in-memory token cache? I have enough work for now not to worry about it, but in two weeks I will have to and I hope there will be some simpler solution that implementing some half inner parts of Azure auth... I think that many would appreciate an easy way to plug and play for the nodeJS environment too, even if it would not be "production-ready" |
we are investigating some support here. I'll see if we can use azure identity as an answer here. |
@ddyett I am not even sure what Azure identity is :D I only want a nodeJS to be able to read and send mail on behalf of any of the users in our organization. (No client-side only server) |
This features should be available after adding @azure/identity token credential support. |
@nikithauc Is there any example to follow? |
@Akxe Currently the work is in progress to add token credential support in the SDK. Please see if the following links help - Register your application to enable authentication to Azure Active Directory using the client secret credential. For more details, please check the following links You could try implement your own custom authentication provider with uses the TokenCredential - https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/CustomAuthenticationProvider.md. and return the access token in the getAccessToken() method of your custom Auth Provider. |
Duplicate to #237 |
Bug Report
Prerequisites
Can you reproduce the problem?
Are you running the latest version?
Are you reporting to the correct repository?
Did you perform a cursory search?
For more information, see the CONTRIBUTING guide.
Description
Error when following steps in the readme.
Console Errors:
C:\Users\akxe\Documents\Programming\rita\node_modules\msal\src\cache\BrowserStorage.ts:18
if (!window) {
^
ReferenceError: window is not defined
at AuthCache.BrowserStorage (C:\Users\akxe\Documents\Programming\rita\node_modules\msal\src\cache\BrowserStorage.ts:18:9)
at new AuthCache (C:\Users\akxe\Documents\Programming\rita\node_modules\msal\src\cache\AuthCache.ts:22:9)
at new UserAgentApplication (C:\Users\akxe\Documents\Programming\rita\node_modules\msal\src\UserAgentApplication.ts:230:29)
at Module../apps/server/src/mail-adapter/microsoft/provider.ts (C:\Users\akxe\Documents\Programming\rita\dist\apps\server\webpack:\apps\server\src\mail-adapter\microsoft\provider.ts:17:2)
at webpack_require (C:\Users\akxe\Documents\Programming\rita\dist\apps\server\webpack:\webpack\bootstrap:19:1)
at Module../apps/server/src/main.ts (C:\Users\akxe\Documents\Programming\rita\dist\apps\server\main.js:518:90)
at webpack_require (C:\Users\akxe\Documents\Programming\rita\dist\apps\server\webpack:\webpack\bootstrap:19:1)
at Object.0 (C:\Users\akxe\Documents\Programming\rita\dist\apps\server\main.js:1133:18)
at webpack_require (C:\Users\akxe\Documents\Programming\rita\dist\apps\server\webpack:\webpack\bootstrap:19:1)
at C:\Users\akxe\Documents\Programming\rita\dist\apps\server\webpack:\webpack\bootstrap:83:1
Screenshots: Not needed
Steps to Reproduce
Create in NodeJS environment:
const authProvider = new ImplicitMSALAuthenticationProvider(
new UserAgentApplication( {
auth: {
clientId: process.env.MICROSOFT_ID!, // Client Id of the registered application
redirectUri: process.env.MICROSOFT_SECRET!,
},
}),
new MSALAuthenticationProviderOptions(process.env.MICROSOFT_SCOPES!.split(' ')),
);
const client = Client.initWithMiddleware({ authProvider });
Expected behavior: No error when following readme
Actual behavior: Error...
Maybe use globalThis to check?
Additional Context
I am transpiling from TS to JS.
Usage Information
SDK Version - [SDK version you are using]
Node (Check, if using Node version of SDK)
Node Version - v14.4.0
Browser (Check, if using Browser version of SDK)
Browser Name - ---
Version - ---
AB#5598
The text was updated successfully, but these errors were encountered: