# 401: Unauthorized

One of my package dependency is hosted on OnePub.

When running `dart pub get` I'm seeing a 401: Unauthorized error.

This means that you are not logged in or not logged into the correct organisation.

The first thing to do is to ensure you are logged into the OnePub on the CLI:

```
onepub login
```

Run `dart pub get` again and hopefully that solves your problem.

If that didn't fix it then read on.

## multiple organisations

You may be a member of multiple OnePub organisations.

If you joined OnePub by accepting an invitation then you will automatically be a member of two OnePub organisations.

When you accept a OnePub invitation we automatically create your own personal OnePub organisation as well as joining you to the organisation you were invited to.

This could mean that when you logged into OnePub from the CLI that you logged into the wrong organisation.

You can check which organisation you are logged into by running:

```
onepub doctor
```

You should see the Organisation name near the bottom of the output.

### switching organisations

To switch between organisations at the CLI run:

```
onepub login
```

When you click on the url displayed by the login command you will be prompted with a droplist showing the organisations that you belong to.

Select the organisation that want to login to.

Run:

```
dart pub get
```

Now your problem should be solved.

No? Then you can reach out for help via the OnePub [discussions](https://github.com/onepub-dev/onepub/discussions) forums


---

# 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.onepub.dev/faq/401-unauthorized.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.
