# Web Api Authentication with Auth0

**URL:** <https://community.auth0.com/t/web-api-authentication-with-auth0/72277>\
**Category:** Get Help\
**Tags:** api, auth0\
**Created:** [October 29, 2021, 12:01am UTC](https://community.auth0.com/t/web-api-authentication-with-auth0/72277 "2021-10-29T00:01:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RohitSingh](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rohitsingh/32/12814_2.png) [@RohitSingh](https://community.auth0.com/u/RohitSingh)\
**Post date:** [October 29, 2021, 12:01am UTC](https://community.auth0.com/t/web-api-authentication-with-auth0/72277/1 "2021-10-29T00:01:15Z")

</div>

Hi

I have created a .net core web api and trying to secure it with Auth0.

My webapi has a domain name that redirects to an IP address on windows server hosted on Amazon.

I configured the API on Auth0 with the domain name that I have . the web api is secure now. the web api also has permission set up as well . Now I am trying to get the authorization token , I get the authorization token using code sample by Auth0.

When I pass the Autorization token in header as "Bearer Authorization " token , I get error Unauthorized Audience is not valid as below

www-authenticate: Bearer error="invalid\_token"error\_description=“The audience 'api domain ’ is invalid”

I dont know how to pass permission i.e “read:message” to the api call.

thanks  
Rohit

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 29, 2021, 7:54pm UTC](https://community.auth0.com/t/web-api-authentication-with-auth0/72277/3 "2021-10-29T19:54:53Z")

</div>

HI @RohitSingh,

Welcome to the Auth0 Community!

I understand that you’ve been encountering errors when requesting access to your API.

First, to pass the corresponding `read:message` permission to the API, you’ll need to pass `read:message` in the `scope` parameter.

Then, make sure that this permission is defined in the `audience` used in that authorization flow.

Please let me know if you have any further questions. I’d be happy to help.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 6, 2021, 11:40pm UTC](https://community.auth0.com/t/web-api-authentication-with-auth0/72277/4 "2021-12-06T23:40:41Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
