How to use the Storyblok CLI with an SSO account?
The Storyblok CLI saves the login information in the .netrc
file in your home directory on Mac or Linux. On Windows, it is stored in the _netrc
file, which is also found in the home directory.
Locating the .netrc or _netrc file
To locate and open the .netrc
file on your Mac, run the command below on your terminal:
You can use Command Prompt to open the file directly on Windows, as shown below:
This command will open the _netrc
file in Notepad. If the file doesn't exist, Notepad will create a new one when you save it.
Modifying the .netrc or _netrc file
When using SSO for login, you need to modify the file. However, this assumes the user has previously logged in using the Storyblok CLI. Follow the steps below if you are using SSO for login:
- Inside your
.netrc
or_netrc
file, search for the line containingmachine api.storyblok.com
. - Below that one, replace the email after login with your SSO ID and Password with an OAuth token that can be generated in the account area OAuth Token.
The content of the file looks similar to this:
When logging in with Storylok CLI, you are prompted to choose a region. Make sure to select the region that matches your Storyblok space.