# How to add Cognito authentication to a serverless API

**URL:** <https://discourse.sst.dev/t/how-to-add-cognito-authentication-to-a-serverless-api/2316>\
**Category:** Chapter Comments\
**Created:** [February 10, 2021, 2:27am UTC](https://discourse.sst.dev/t/how-to-add-cognito-authentication-to-a-serverless-api/2316 "2021-02-10T02:27:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayair](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/jayair/32/9_2.png) [@jayair](https://discourse.sst.dev/u/jayair)\
**Post date:** [February 10, 2021, 2:27am UTC](https://discourse.sst.dev/t/how-to-add-cognito-authentication-to-a-serverless-api/2316/1 "2021-02-10T02:27:28Z")

</div>

Link to chapter — [https://serverless-stack.com/examples/how-to-add-cognito-authentication-to-a-serverless-api.html](https://serverless-stack.com/examples/how-to-add-cognito-authentication-to-a-serverless-api.html)

---

<div class="post-metadata">

**Author:** ![strangekai](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/strangekai/32/1129_2.png) [@strangekai](https://discourse.sst.dev/u/strangekai)\
**Post date:** [February 18, 2021, 9:00am UTC](https://discourse.sst.dev/t/how-to-add-cognito-authentication-to-a-serverless-api/2316/2 "2021-02-18T09:00:40Z")

</div>

I’m getting “The specified permissions is not supported.” when trying to run sst start.

```
Building Lambda function src/private.main
Building Lambda function src/public.main

Error: The specified permissions is not supported.
    at permissions.forEach (/Users/kaimacmaster/Sites/mj-backend/node_modules/@serverless-stack/resources/src/util/permission.ts:104:15)
    at Array.forEach (<anonymous>)
    at Object.attachPermissionsToRole (/Users/kaimacmaster/Sites/mj-backend/node_modules/@serverless-stack/resources/src/util/permission.ts:51:17)
    at Auth.attachPermissionsForAuthUsers (/Users/kaimacmaster/Sites/mj-backend/node_modules/@serverless-stack/resources/src/Auth.ts:249:5)
    at new MyStack (/Users/kaimacmaster/Sites/mj-backend/lib/MyStack.ts:34:10)
    at Object.main (/Users/kaimacmaster/Sites/mj-backend/lib/index.ts:5:3)
    at Object.<anonymous> (/Users/kaimacmaster/Sites/mj-backend/.build/run.js:57:16)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

There was an error synthesizing your app.
```

---

<div class="post-metadata">

**Author:** ![frank](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/frank/32/1183_2.png) [@frank](https://discourse.sst.dev/u/frank)\
**Post date:** [February 21, 2021, 4:06am UTC](https://discourse.sst.dev/t/how-to-add-cognito-authentication-to-a-serverless-api/2316/3 "2021-02-21T04:06:57Z")

</div>

@strangekai Can you paste here the line where you are calling `auth.attachPermissionsForAuthUsers` to grant the permissions?
