# OAuth 2.0 Error: access_denied (The user or authorization server denied the request)

**Code:** `access_denied` · **Category:** Authentication · **Seen on:** REST API

The authorization request was refused — the user clicked Cancel/Deny on the consent screen, or a policy denied access.

## Meaning

Providers redirect back with ?error=access_denied. Apart from a real user “No”, it happens when an app in testing mode is used by a non-test user, an admin blocks the app, or the account can’t grant the requested scopes.

## Common causes

- User cancelled or denied consent
- App in testing mode and user not added as a tester (Google)
- Organisation policy blocks third-party apps
- Requested scopes not allowed for this account

## Quick fix

1. Handle error=access_denied gracefully (show “sign-in cancelled”)
2. Add test users or publish the OAuth app
3. Ask the admin to allow the app / reduce scopes

## Detailed fix by platform

### JavaScript

1. 

```javascript
const params = new URLSearchParams(location.search);
if (params.get("error") === "access_denied") showMessage("Sign-in was cancelled.");
```


## How to diagnose

1. **Callback** — error and error_description params
2. **App status** — Testing or production?
3. **Admin** — Policies?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/auth/oauth-access-denied)
