Skip to content

Instantly share code, notes, and snippets.

@skogsmaskin
Last active November 16, 2017 18:05
Show Gist options
  • Save skogsmaskin/34f74609d1969eeb532317552d18c67b to your computer and use it in GitHub Desktop.
Save skogsmaskin/34f74609d1969eeb532317552d18c67b to your computer and use it in GitHub Desktop.
Sanity.io : Auth the CLI when installed remotely
  • Go to https://api.sanity.io/v1/auth/login/github?type=token&origin=http://localhost

    Exchange github for google if you prefer that. You don't need anything running on localhost.

  • Pick out the value of the sid param in the return url trying to load on localhost.

  • Load https://api.sanity.io/v1/auth/fetch?sid=xxxx using the sid value from above.

  • Pick out the token from the result.

Create on the remote server in the home directory for the user running the CLI:

~/.config/sanity/config.json

Set the contents to this, replacing "yyyy" with the token value from above:

{
	"authToken": "yyyy",
	"authType": "normal"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment