# Request Authorization

In order to perform actions on behalf of a user, they must first authorize you to do so.

> **WARNING:** When requesting authorization from a user, the domain is **app.cronofy.com** and not **api.cronofy.com** that you make the API calls to.

Authorization is received by performing the <a href="https://www.rfc-editor.org/rfc/rfc6749#section-1.3.1">"Authorization Code" version of authorization</a> as specified in <a href="https://www.rfc-editor.org/rfc/rfc6749#section-4.1">section 4.1 of RFC 6749</a>.

This will issue you a short-lived, single-use `code` that you will be able to exchange for an `access_token` and `refresh_token` for the user.

#### Example request URL
The parameters are encoded in the querystring as specified in <a href="https://www.rfc-editor.org/rfc/rfc6749#appendix-B">appendix B of RFC 6749</a>. Additional linebreaks are added to the request's path for clarity.

```
https://app.cronofy.com/oauth/authorize
    ?response_type=code
    &client_id={CLIENT_ID}
    &redirect_uri={REDIRECT_URI}
    &scope={SCOPE}
    &state={STATE}
```

#### Request URL parameters
##### `data_center_app_url` *(required)*

The URL for the data center you want to communicate with. Possible choices are:

- `app-au.cronofy.com` - Australia
- `app-ca.cronofy.com` - Canada
- `app-de.cronofy.com` - Germany
- `app-sg.cronofy.com` - Singapore
- `app-uk.cronofy.com` - United Kingdom
- `app.cronofy.com` - United States

Find out more about [Cronofy's data centers](/developers/data-centers/index.md).
##### `response_type` *(required)*

Must always be `code` as that is the only grant type supported by Cronofy.

##### `client_id` *(required)*

The `client_id` issued to you by Cronofy to authenticate your OAuth Client. Authenticates you as a trusted client.

##### `redirect_uri` *(required)*

The HTTP or HTTPS URI you wish the user's authorization request decision to be redirected to.

> **WARNING:** In development this can be any value, but in production this has to be a **pre-registered** value. This helps us guard against phishing attacks by controlling where we return authorization codes to for your application. We can only support wildcards in the host name for subdomains of domains under your control, eg:
`https://*.example.com/auth/cronofy/callback` Otherwise, the URL must be static and we can support multiple values. If your URL is dynamic, you should utilize the `state` parameter to pass variables. See [our FAQ on using this to support dynamic values in your OAuth flow](/developers/faqs/application-management/state-param/index.md).

##### `scope` *(required)*

The scope of the privileges you want the eventual `access_token` to grant.  Only one scope is currently supported:

- **organizational_unit_scheduler** to allow access to the user's Cronofy Organizational Unit configuration and to create Scheduling Requests.

The format of this value is specified in <a href="https://www.rfc-editor.org/rfc/rfc6749#section-3.3">section 3.3 of RFC 6749</a> but is a space-separated [`String`](/developers/api/data-types/index.md) of named scopes.

##### `state` *(optional)*

A value that will be returned to you unaltered along with the user's authorization request decision.

The OAuth 2.0 RFC recommends <a href="https://www.rfc-editor.org/rfc/rfc6749#section-10.12">using this to prevent cross-site request forgery</a>.

##### `code_challenge` *(optional)*

A parameter used to protect against an authorization code intercept attack defined in [RFC 7636 - Proof Key for Code Exchange by OAuth Public Clients](https://www.rfc-editor.org/rfc/rfc7636).

Providing this value will mean that a corresponding `code_verifier` parameter must be provided when redeeming an authorization `code` for an `access_token`.

##### `code_challenge_method` *(optional)*

Describes the method used to verify the `code_verifier` parameter that will be sent when the `access_token` is requested. Two values are supported.

- `S256`

- `plain`

If not passed then `plain` is the default used if a `code_challenge` parameter is provided.

##### `locale` *(optional)*

A [`String`](/developers/api/data-types/index.md) value for the locale to use for display purposes. If not provided we will use the locale provided by their browser. In general you will not want to supply this and instead rely on the user's browser to provide the correct locale.

Currently supported locales are:

- `ar` Arabic

- `cs` Czech

- `cy` Welsh

- `de` German

- `en` US English (default)

- `es` Spanish

- `fr` French

- `fr-CA` Canadian French

- `he` Hebrew

- `it` Italian

- `ja` Japanese

- `nl` Dutch

- `pl` Polish

- `pt-BR` Brazilian Portuguese

- `ru` Russian

- `sv` Swedish

- `tr` Turkish

- `zh-CN` Simplified Chinese

#### Response URL parameters
You will not receive a direct response to your Authorization Request, instead the user will be redirected to the `REDIRECT_URI` with additional querystring parameters specified.

The responses are fully specified in <a href="https://www.rfc-editor.org/rfc/rfc6749#section-4.1.2">section 4.1.2 of RFC 6749</a>.

#### Successful response
##### `code`

A short-lived, single-use `code` to be used to make an [Access Token Request](/developers/api/authorization/request-token/index.md).

Will always be 32 character [`String`](/developers/api/data-types/index.md) of ASCII characters.

##### `state`

The value you passed for the `state` within the authorization request.

#### Error response
##### `error`

A single ASCII error code. The complete list is within <a href="https://www.rfc-editor.org/rfc/rfc6749#section-4.1.2.1">section 4.1.2.1 of RFC 6749</a>, these are the most commonly encountered:

- **access_denied** the user declined your request

- **unsupported_response_type** your request's `response_type` was not `code`

- **invalid_scope** no valid scopes were specified in your request's `scope`



---
[Read in HTML](/developers/api/organization-connect/request-authorization/)