> For the complete documentation index, see [llms.txt](https://docs.podigee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.podigee.com/documentation/start-here/ai-agents/connect-and-authorize/sign-in-and-out-with-the-pdg-cli.md).

# Sign in and out with the pdg CLI

Authorize pdg through Podigee, verify the active profile, and end the local session safely.

Authorize `pdg` in your browser, verify the selected Podigee account, and sign out when the profile is no longer needed.

## Before you start

* Complete [Install the pdg CLI](/documentation/start-here/ai-agents/connect-and-authorize/install-the-pdg-cli.md).
* Have an active Podigee account.
* Make local port `9876` available for the temporary login callback.

## Sign in

Run:

```sh
pdg auth login
```

1. Allow `pdg` to open the Podigee authorization page in your browser.
2. Sign in to Podigee.
3. Review the `pdg` client name, selected account, return address, and requested permissions.
4. Select **Authorize** only when all details are correct.
5. Return to the terminal.

Check the saved profile:

```sh
pdg auth status
pdg me --json
```

The configuration is stored in the protected `~/.pdg/config.yml` file. Do not copy this file into a project or share it with another user.

## Use a named profile

Create a separate profile when you work with more than one Podigee account:

```sh
pdg auth login --profile work
pdg auth status --profile work
pdg auth use work
```

Each profile keeps its own resource, authorization issuer, credential, and selected tenant.

## Sign out

Run:

```sh
pdg auth logout
```

For a named profile, run:

```sh
pdg auth logout --profile work
```

Signing out removes the local profile credential. Revoke the connector in Podigee when you must also invalidate its server-side access and refresh tokens.

## Expected result

After login, `pdg me --json` returns the same account or organization that you approved in the browser. After logout, that profile cannot make an authenticated Podigee request.

## If login does not finish

Confirm that port `9876` is not in use. Retry `pdg auth login` after the other process releases the port. If the browser approval expired, start a new login instead of reusing the old page.

If the account is wrong, sign out and create a separate authorization for the correct account.

## Next step

[Connect and run your first read-only check](/documentation/start-here/ai-agents/start-here/connect-and-run-your-first-read-only-check.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.podigee.com/documentation/start-here/ai-agents/connect-and-authorize/sign-in-and-out-with-the-pdg-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
