Sp-dev-docs: AadHttpClient - not getting token in Edge browser anymore

Created on 7 Jun 2019  路  16Comments  路  Source: SharePoint/sp-dev-docs

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

Expect token to be returned with TokenFactoryiframe when using AadHttpClient in spfx also in the Edge browser. Has worked before but recently stopped working.

Observed Behavior

Works for other browsers like Chrome, Firefox and IE, but not Edge (not even in In Private mode).

Steps to Reproduce

Test a web part using AadHttpClient in Edge and in Chrome, to see the difference.

Needs Reproduce Steps auth spfx-general tracked

Most helpful comment

There was a regression in the service that caused this issue. This issue should now be resolved. Please open a new issue if you're still seeing this behavior.

Thanks!

All 16 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

hey @AndreasNorefalk, we are not aware of any regressions here especially on Edge.
Can you please share the example or tell us the steps to repro the issue?

thanks a lot

Have tried both using the AadHttpClient with: new AadHttpClient(..) and through the factory with this.context.aadHttpClientFactory. They both have stopped working in Edge.

Getting the token through aadTokenProviderFactory and then using the regular HttpClient however seems to be working fine in Edge.

Thanks @AndreasNorefalk. Can you please share the sample code that doesn't work for you? also, what version of Edge is not working for you?

thanks

hi, I am not sure if this is related so I post this issue over here as we are having issue with edge too. I can see we are able to retrieve the token ( i tested the token by grabbing it and use it in Postman and the token is valid and the call was successful)

What i have found so far:
I identified the issue in this file https://spoprod-a.akamaihd.net/files/sp-client-prod_2019-05-31.011/sp-pages-assembly_en-au_226a2c779e07f656911b8c4964fa1b69.js

return n.headers = new Headers(n.headers || void 0), n.headers.append("Authorization", "Bearer " + o), g.fetchCore(r, new Request(t, n), s._serviceScope, s._fetchProvider, e._className);

i have highlighted the issue in Edge as it would throw invalid argument error

We are using spfx 1.8.1 and Edge version is 44.18362.1.0

regards

Hi, the following Edge version:

Microsoft Edge 44.17763.1.0
Microsoft EdgeHTML 18.17763

Example:
let apiClient = new AadHttpClient(this.props.context.serviceScope, adalConfig.clientId); apiClient.get(url, AadHttpClient.configurations.v1, { cache: "no-cache" }).then(response => { resolve(response); }).catch(err => { reject(err); });

I am having the same issue. Both in a normal and isolated SPFX webparts. My Edge is a bit older: Microsoft Edge 41.16299.1004.0.

Receiving this error: TypeError: Invalid argument at Anonymous function (https://spoprod-a.akamaihd.net/files/sp-client-prod_2019-05-31.012/isolated-web-part-application-assembly_default_fd8d4d8aab6464fb64e6cd4cd176ee17.js:516:42819)

Same issue here. Calling the AadHttpClientFactory:

this.aadClient = await this.context.aadHttpClientFactory.getClient(AppSettings.AppId);
let httpResponse: HttpClientResponse = await this.aadClient
.get(${AppSettings.WebApiUrl}/${groupId}, AadHttpClient.configurations.v1);

Receiving this error: TypeError: Invalid argument

Using Edge: Microsoft Edge 44.17763.1.0 and SPFx 1.8.1

We are now actively looking into this. Thanks for reporting the issue.

Thank you Vesa! My client would really appreciatie this...

I have the same issue

Internet Explorer Edge: 18.17763
SPFx: 1.8.2

with: AadHttpClientFactory

Call azure web api as anonymous and the error is: Invalid argument

hey guys
we have to make sure the header isn't undefined. so this is what you can do

    const requestHeaders: Headers = new Headers();
    requestHeaders.append('Accept', 'application/json');
    const httpClientOptions: IHttpClientOptions = {
      headers: requestHeaders
    };
    return client
      .get(url, AadHttpClient.configurations.v1,httpClientOptions)

obviously you can add whatever header you like/appropriate/applicable to you

this has been tested and working for IE edge

spfx 1.8.1 and Edge version is 44.18362.1.0

regards

You won me the answer.

It works for me:

const requestHeaders: Headers = new Headers();
requestHeaders.append('Content-type', 'application/json');
requestHeaders.append('Cache-Control', 'no-cache');

return client.get('https://...', AadHttpClient.configurations.v1, { cache: "no-cache", headers: requestHeaders })

In IE it worked fine, but now I have to execute the call twice for the changes to be refiled, that's why I got the handling of the cache, if someone knows how to correct it, tell how to do it please

There was a regression in the service that caused this issue. This issue should now be resolved. Please open a new issue if you're still seeing this behavior.

Thanks!

I can confirm this is working now! Thanks @lahuey and @VesaJuvonen for the quick action on this.

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thechriskent picture thechriskent  路  3Comments

patrick-rodgers picture patrick-rodgers  路  3Comments

mikeparkie picture mikeparkie  路  3Comments

waldekmastykarz picture waldekmastykarz  路  3Comments

bengtmoss picture bengtmoss  路  3Comments