# OAuth Periodically Failing

**URL:** <https://community.smartthings.com/t/oauth-periodically-failing/64096>\
**Category:** Writing SmartApps\
**Created:** [November 22, 2016, 1:12am UTC](https://community.smartthings.com/t/oauth-periodically-failing/64096 "2016-11-22T01:12:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jh0](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@jh0](https://community.smartthings.com/u/jh0)\
**Post date:** [November 22, 2016, 1:12am UTC](https://community.smartthings.com/t/oauth-periodically-failing/64096/1 "2016-11-22T01:12:10Z")

</div>

A while back I made a thing, [documented here](https://community.smartthings.com/t/an-alternate-approach-to-adt-integration/35711), which uses some software running on a local host to push events to a SmartApp in the ST cloud using OAuth. Everything is working for me, but I’m trying to help @aliby get it working and they are running into some OAuth problems. About 10% of the time, the cloud server responds with:

```
{"error":true,"type":"AccessDenied","message":"This request is not authorized by the specified access token"}
```

The other 90% of the time the events go through properly. My software uses the following invocation (with a real token/endpoint) to send the data:

```
curl -H 'Authorization: Bearer 12345678-1234-1234-1234-1234567890ab' -H 'Content-Type: application/json' -X PUT -d '@/var/www/html/deviceState.json' https://graph.api.smartthings.com:443/api/smartapps/installations/12345678-1234-1234-1234-1234567890ab/event
```

Any OAuth wizards out there that might have an idea why this would only work _most_ of the time?
