# Installation and Authentication

## Installation

To scan and secure Python projects, you first need Safety CLI version 3 to be installed on your machine.

{% hint style="info" %}
To check whether Safety CLI 3.x is already installed, open your **terminal** and type:

```
safety --version
```

{% endhint %}

If the safety command is not found, **or your safety version is less than 3.0,** you need to install Safety version 3 using the following command before continuing:

```
pip install safety
```

{% hint style="info" %}
If you already have Safety installed, please use `pip install -U safety`
{% endhint %}

## Login Methods

When the installation of Safety version 3 has been confirmed, launch your terminal and authenticate using one of the methods outlined below.

### **Free & Team Customers**

Customers on our Free and Team plans will log in using an email and password defined when you [create your account](https://platform.safetycli.com/register/).

In your **terminal,** type:

```
safety auth login
```

Your default browser will open and you will be asked to authenticate using your Safety username and password. Login via Google is currently supported, and support for additional SSO providers will be added soon.

Once logged in, return to your terminal to verify Safety is authenticated with your account details by typing:

```
safety auth
```

<figure><img src="https://1428014516-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0ABDwXSDJWM5juLdc6ie%2Fuploads%2Fgit-blob-6b8a5f7ece1ca354d52b821cb39e579b5f891614%2Fimage.png?alt=media" alt="" width="563"><figcaption><p>1. "safety auth" launches the default browser.</p></figcaption></figure>

<figure><img src="https://1428014516-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0ABDwXSDJWM5juLdc6ie%2Fuploads%2Fgit-blob-6410c9b0ce01927e93d2172cc3a31911c693b875%2Fimage.png?alt=media" alt="" width="563"><figcaption><p>2. Browser-based Authentication</p></figcaption></figure>

<figure><img src="https://1428014516-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0ABDwXSDJWM5juLdc6ie%2Fuploads%2Fgit-blob-8952157a4eb7c9ec28bda3d1748451924f96835b%2Fimage.png?alt=media" alt="" width="563"><figcaption><p>"safety auth" triggering browser authentication and successful login</p></figcaption></figure>

### **Enterprise Customers**

Enterprise customers can leverage the method described above or SAML-based authentication, allowing users to be authenticated using organization-specific identities. The latter preserves approved authentication flows and prevents access to anyone not registered in your internal identity platform.

As above, when installation has been confirmed, in your **terminal,** type:

```
safety auth login
```

This will open your browser to authenticate the Safety CLI tool using your work email address and password. If your organization uses SAML authentication, you will be redirected to your corporate login page.

Once logged in, return to your terminal to verify Safety is authenticated with your account details by typing:

```
safety auth
```

If you are unclear as to which method your organization uses, please contact your administrator or email us at <support@safetycli.com>.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.safetycli.com/safety-docs/safety-cli/installation-and-authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
