question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authorization Header: Basic Auth header sent in Safari but Chrome sends Bearer

See original GitHub issue

Summary

I’ve scoured stack overflow and the issues list on this site and I cannot find a similarly described problem (or potential solution) for the problem I’m seeing.

I’m running an express server in NodeJS that serves up an API and the client front end. The API is authenticated with JWT while the client is authenticated with Basic.

Axios is configured on the client and is used to make API calls.

For reference:

this.axios = axios.create({ baseURL: '/api', headers: { Authorization: Bearer ${getToken()} } });

Problem:

When using a browser other than Chrome

Using axios to make an API call, it seems that the browser is ignoring the axios configuration for the authorization header and instead replacing it with: Authorization: Basic XXXXXXXXXX

I’m not certain this is an axios issue and I do not know why Chrome works as expected but other browsers do not.

Any help would be greatly appreciated.

Context

  • axios version: latest
  • Environment: node v9.1.0, express 4.14.0, Safari 11.1.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:17
  • Comments:9

github_iconTop GitHub Comments

5reactions
bluce1017commented, Apr 10, 2018

The latest version of firefox sends the correct Auth Header. Safari and IE seem to ignore it and continue to send Basic Auth…

2reactions
niksynovcommented, Nov 21, 2018

@mmmikeal We added support for other name of Authorization header on the backend. That was a solution. And I guess this is not related to axios at all. This is specific case of safari

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Safari http request header is not reflecting on axios ...
Basic Auth and Bearer Auth use the same Authorization header. Chrome, Firefox, and Edge can authenticate with a username/password and pass a ...
Read more >
Safari Authorization header - Laracasts
I am using the basic api authentication which is working in chrome and locally in safari. On the live server safari is returning...
Read more >
Safari does not persist the Authorization header on redirect
It seems to make sense to keep the authorization header for same origin redirections. It would be good to check where we are...
Read more >
Authorization - HTTP - MDN Web Docs - Mozilla
This header indicates what authentication schemes can be used to access the resource (and any additional information needed by the client to use ......
Read more >
Safari not prompting for credentia… | Apple Developer Forums
What we're basically doing is SSO using NTLM, by calling a authentication server from ... Access-Control-Allow-Headers: * (I also tried combinations with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found