Skip to content

Consume aadHttpClientFactory.getClient response code 200 but no data fetched #5175

@ozie02

Description

@ozie02

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

I have created an extension that consists of child components and a webpart to make a call to an Azure function that has authentication enabled which would return data in the response after successfully authenticating.

Observed Behavior

The webpart returns data after successfully authenticating but not for the extension even though they are consuming the same API. Once you click the button the extension attempts to fetch data from the API after authenticating but it seems the response comes back blank even though the response code is 200.

I am passing this.context from the Root component which extends BaseApplicationCustomizer to the child component (Root --> ReactHeader --> ReactPanel --> ReactOrders.ts) which requires to make authentication and the API call.

On the other hand, for some reason after upgrading the extension to SPFX 1.9.1, the generated files are showing in the source folders.

I have added more details (steps + Screenshots) in each example.

Steps to Reproduce

The first example is a webpart consuming my Azure Function and rendering data accordingly (this is to ensure the web service configuration is healthy).

In the second example, I have an Extension attempting to use the same web service via child component that fails to fetch data but successfully authenticated.

Webpart Source Code + Steps: https://github.com/ozie02/Learning/tree/master/Webpart/contoso-api

Extension Source Code + Steps: https://github.com/ozie02/Learning/tree/master/Extensions/contoso-api-extension

Thanks for your contribution! Sharing is caring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authCategory: Authentication (Azure AD / etc)area:spfxCategory: SharePoint Framework (not extensions related)status:answeredAnswer to a question.type:questionQuestion... if answered, will be tagged as such.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions