How to use the Storyblok CLI with an SSO account?
The Storyblok CLI (opens in a new window) 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:
nano ~/.netrc
You can use Command Prompt to open the file directly on Windows, as shown below:
notepad %USERPROFILE%\_netrc
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 (opens in a new window) . 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:
machine api.storyblok.com
login SSO_ID
password Your_Oauth_Token
When logging in with Storylok CLI (opens in a new window) , you are prompted to choose a region (opens in a new window) . Make sure to select the region that matches your Storyblok space.