Skip to content

Commit

Permalink
fix: do not send in token to apiClient specifically during unauthenti…
Browse files Browse the repository at this point in the history
…cated requests (#3250)

Pushed it so that we can include this in the nearest release! Good job! :)
  • Loading branch information
svirs committed Apr 25, 2022
1 parent 524cc97 commit 492e7cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/@sanity/cli/src/util/clientWrapper.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import chalk from 'chalk'
import client from '@sanity/client'
import {generateHelpUrl} from '@sanity/generate-help-url'
import getUserConfig from './getUserConfig'
Expand All @@ -21,7 +22,9 @@ const authErrors = () => ({
onError: (err) => {
const statusCode = err.response && err.response.body && err.response.body.statusCode
if (statusCode === 401) {
err.message = `${err.message}. For more information, see ${generateHelpUrl('cli-errors')}.`
err.message = `${err.message}. You may need to login again with ${chalk.cyan(
'sanity login'
)}.\nFor more information, see ${generateHelpUrl('cli-errors')}.`
}
return err
},
Expand Down Expand Up @@ -67,7 +70,7 @@ export default function clientWrapper(manifest, configPath) {
...apiConfig,
apiVersion: '1',
dataset: apiConfig.dataset || '~dummy-placeholder-dataset-',
token: token,
token: requireUser ? token : undefined,
useProjectHostname: requireProject,
requester: requester,
useCdn: false,
Expand Down

3 comments on commit 492e7cd

@vercel
Copy link

@vercel vercel bot commented on 492e7cd Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

studio-workshop – ./dev/workshop

studio-workshop.sanity.build
studio-workshop-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 492e7cd Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 492e7cd Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

perf-studio – ./

perf-studio-git-next.sanity.build
perf-studio.sanity.build

Please sign in to comment.