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

Alpha does not work with provideHttpClient #5988

Closed
grosch-intl opened this issue May 8, 2023 · 13 comments
Closed

Alpha does not work with provideHttpClient #5988

grosch-intl opened this issue May 8, 2023 · 13 comments
Assignees
Labels
feature Feature requests. msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications

Comments

@grosch-intl
Copy link

Core Library

MSAL.js v2 (@azure/msal-browser)

Core Library Version

3.0.0-alpha.0

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

3.0.0-alpha.0

Public or Confidential Client?

Public

Description

If I try and use provideHttpClient() instead of importing HttpClientModule then things don't work. There's not a token acquired and passed to the server.

Error Message

No response

Msal Logs

No response

MSAL Configuration

const publicClientApplication = new PublicClientApplication({
    auth: {
        clientId: environment.azure.clientId,
        authority: 'https://login.microsoftonline.com/...',
        redirectUri: window.location.origin
    },
    cache: {
        cacheLocation: BrowserCacheLocation.LocalStorage,
        storeAuthStateInCookie: false
    }
})

Relevant Code Snippets

bootstrapApplication(AppComponent, {
        providers: [
            importProvidersFrom(
                HttpClientModule,    // <=- Have to still do this
                ...
            ),
            // provideHttpClient(),      // <=- This doesn't work with the current msal interceptor.

Reproduction Steps

See code snippet

Expected Behavior

Shouldn't have to use the old HttpClientModule after angular 14.

Identity Provider

Azure AD / MSA

Browsers Affected (Select all that apply)

Chrome

Regression

No response

Source

External (Customer)

@grosch-intl grosch-intl added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels May 8, 2023
@ghost ghost added the Needs: Attention 👋 Awaiting response from the MSAL.js team label May 8, 2023
@github-actions github-actions bot added msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels May 8, 2023
@ghost ghost assigned hectormmg May 8, 2023
@ghost
Copy link

ghost commented May 14, 2023

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

@tnorling tnorling added feature Feature requests. and removed question Customer is asking for a clarification, use case or information. bug-unconfirmed A reported bug that needs to be investigated and confirmed Needs: Attention 👋 Awaiting response from the MSAL.js team labels May 18, 2023
@fayeBabacar78
Copy link

@grosch-intl Do you have a workaround solution? If you haved configured MsalInterceptor, can you share your configuration?

@grosch
Copy link

grosch commented May 20, 2023

I'm just using the HttpClientModule until Microsoft provides an update.

@grosch-intl
Copy link
Author

Any updates on this?

@jo-arroyo
Copy link
Collaborator

@grosch-intl Apologies for the delay, we will investigate this and update this thread when we have a fix.

@Marcel0024
Copy link

Marcel0024 commented Jun 19, 2023

I manage to get it dynamic configurations to work with HttpClient, But then no other HttpClient calls work.

@grosch-intl can you share your relevant main.ts

@grosch-intl
Copy link
Author

@Marcel0024 I included that in the details of this ticket.

@fayeBabacar78
Copy link

fayeBabacar78 commented Jun 21, 2023

@Marcel0024 have a look here #6080

For more details, check this repos out at https://github.com/mdddev/msal-b2c/blob/main/angular15-msal3-standalone

@grosch-intl
Copy link
Author

@jo-arroyo Just updated to 3.0.0-beta.0 and still having the same issue.

@ckorherr
Copy link

I suggest applying provideHttpClient(withInterceptorsFromDi()). Implementing this approach worked successfully in my case.

@dzhavat
Copy link
Contributor

dzhavat commented Jul 4, 2023

Adding provideHttpClient(withInterceptorsFromDi()) worked for us as well. We're on 3.0.0-beta.0.

@grosch-intl
Copy link
Author

@ckorherr Thanks, that works well.

@jo-arroyo Should we close this ticket and open a new one asking for an interceptor that doesn't require the DI to be used?

@jo-arroyo
Copy link
Collaborator

@grosch No need, we will track this issue as a feature request for an interceptor that doesn't require DI. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature requests. msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications
Projects
None yet
Development

No branches or pull requests

9 participants