> For the complete documentation index, see [llms.txt](https://developer.onehub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.onehub.com/api/authorization.md).

# Authorization

The Onehub API uses [OAuth 2.0 Draft 10](http://tools.ietf.org/html/draft-ietf-oauth-v2-10) for both authorization and authentication. Authorize your account when using the API by including your client ID and secret along with your preferred OAuth 2 authorization method.

We recommend using an [existing OAuth 2 library](http://oauth.net/2) in your language of choice.

{% hint style="warning" %}
All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Requests made over plain HTTP will results in an [error](/api/errors.md). Requests made without authorization will also result in an [error](/api/errors.md).
{% endhint %}

### Supported OAuth 2.0 Grant Types

#### Authorization

Primarily used in the context of integrating your app with Onehub and allowing users to grant it access to their data via a web-based authorization flow. More information on this grant type can be [found here](https://oauth.net/2/grant-types/authorization-code/).

#### Password

Used for directly authenticating as a user. Use this grant type if you want to access your own Onehub data via the API. More information on this grant type can be [found here](https://oauth.net/2/grant-types/password/).

## Authorization Endpoint

```
https://ws-api.onehub.com/oauth/authorize
```

## Password Grant Examples

* [Ruby](https://github.com/onehub/api-examples/blob/master/ruby/password_grant_REPL.rb)
* [Java](https://github.com/onehub/api-examples/tree/master/java/oauth2)


---

# 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://developer.onehub.com/api/authorization.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.
