# AZP check on IDToken requires SPA client\_id as audience?!

**URL:** <https://community.auth0.com/t/azp-check-on-idtoken-requires-spa-client-id-as-audience/79514>\
**Category:** Get Help\
**Created:** [March 8, 2022, 4:57pm UTC](https://community.auth0.com/t/azp-check-on-idtoken-requires-spa-client-id-as-audience/79514 "2022-03-08T16:57:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FullStackFool](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fullstackfool/32/25823_2.png) [@FullStackFool](https://community.auth0.com/u/FullStackFool)\
**Post date:** [March 8, 2022, 4:57pm UTC](https://community.auth0.com/t/azp-check-on-idtoken-requires-spa-client-id-as-audience/79514/1 "2022-03-08T16:57:09Z")

</div>

Please include the following information in your post:

- **Which SDK this is regarding:** auth0-php
- **SDK Version:** e.g. 8.1
- **Platform Version:** php 8.1
- **Code Snippets/Error Messages/Supporting Details/Screenshots:** [8.0: AZP is now checked against the audience · Issue #606 · auth0/auth0-PHP · GitHub](https://github.com/auth0/auth0-PHP/issues/606)

As per the linked issue on the auth0-php package, when validating an ID token in an API you now need to include the SPA’s (application’s) `client_id` as an audience, as the package now validates the `azp` claim against the `audience` array.

1. This seems counter-intuative; The audience is an identifier, or array of identifiers, of **resource servers** the token is valid for. The `azp` is the identifier of the **origin** , or the authorised party. Why are we now required to validate the id of the origin against an array of targets?!

2. This now means that if you have an API which is targetted by multiple different SPAs (applications) then all of the SPA `client_id`s need to be included in that API’s audience configuration - which is tedious as hell. Is there anyway in the dashboard to avoid having to do this?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 8, 2022, 7:01pm UTC](https://community.auth0.com/t/azp-check-on-idtoken-requires-spa-client-id-as-audience/79514/3 "2022-03-08T19:01:07Z")

</div>

Hi @FullStackFool!

It looks like the maintainer of that SDK was able to respond in the GH issue you linked. I am going to repost their response here for the benefit of other users:

> Hi `@fullstackfool`👋 Yes, that’s working as intended. In your case, you may need to pass the client\_id of your SPA as an audience value in the array for the claim to validate correctly.

I’m curious why you are sending the ID token to your resource server and not the access token. I typically see the ID token consumed by frontend client and the access token used to request resources from the backend API/resource server.

---

<div class="post-metadata">

**Author:** ![FullStackFool](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fullstackfool/32/25823_2.png) [@FullStackFool](https://community.auth0.com/u/FullStackFool)\
**Post date:** [March 9, 2022, 9:39am UTC](https://community.auth0.com/t/azp-check-on-idtoken-requires-spa-client-id-as-audience/79514/4 "2022-03-09T09:39:01Z")

</div>

> I’m curious why you are sending the ID token to your resource server and not the access token

Just a miss-type, meant access token.

I appreciated their response, but wanted to take this topic deeper. They don’t want to enable Github Discussions on that repo, so figured here would be best.

This question is going to come up a lot from users, I think:

> This now means that if you have an API which is targetted by multiple different SPAs (applications) then all of the SPA `client_id` s need to be included in that API’s audience configuration - which is tedious as hell. Is there anyway in the dashboard to avoid having to do this?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [May 11, 2023, 12:54pm UTC](https://community.auth0.com/t/azp-check-on-idtoken-requires-spa-client-id-as-audience/79514/5 "2023-05-11T12:54:31Z")

</div>


