Skip to content

Commit 6f0b3f1

Browse files
authored
Examples: Query/Authorization - Change authentication to authorization headers (reduxjs#1329)
1 parent 2ff1fa4 commit 6f0b3f1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

examples/query/react/authentication-with-extrareducers/src/app/services/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const api = createApi({
2323
// By default, if we have a token in the store, let's use that for authenticated requests
2424
const token = (getState() as RootState).auth.token
2525
if (token) {
26-
headers.set('authentication', `Bearer ${token}`)
26+
headers.set('authorization', `Bearer ${token}`)
2727
}
2828
return headers
2929
},

examples/query/react/authentication-with-extrareducers/src/mocks/handlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const token = nanoid()
66
export const handlers = [
77
rest.get('/protected', (req, res, ctx) => {
88
const headers = req.headers.all()
9-
if (headers.authentication !== `Bearer ${token}`) {
9+
if (headers.authorization !== `Bearer ${token}`) {
1010
return res(
1111
ctx.json({
1212
message: 'You shall not pass. Please login first.',

examples/query/react/authentication/src/app/services/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const api = createApi({
2323
// By default, if we have a token in the store, let's use that for authenticated requests
2424
const token = (getState() as RootState).auth.token
2525
if (token) {
26-
headers.set('authentication', `Bearer ${token}`)
26+
headers.set('authorization', `Bearer ${token}`)
2727
}
2828
return headers
2929
},

examples/query/react/authentication/src/mocks/handlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const token = nanoid()
66
export const handlers = [
77
rest.get('/protected', (req, res, ctx) => {
88
const headers = req.headers.all()
9-
if (headers.authentication !== `Bearer ${token}`) {
9+
if (headers.authorization !== `Bearer ${token}`) {
1010
return res(
1111
ctx.json({
1212
message: 'You shall not pass. Please login first.',

0 commit comments

Comments
 (0)