# Multiple Apps, Single API, mixed oauth flows

**URL:** <https://community.auth0.com/t/multiple-apps-single-api-mixed-oauth-flows/56757>\
**Category:** Get Help\
**Tags:** jwt, api, clients, auth0\
**Created:** [January 25, 2021, 4:25pm UTC](https://community.auth0.com/t/multiple-apps-single-api-mixed-oauth-flows/56757 "2021-01-25T16:25:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjungers](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sjungers/32/19971_2.png) [@sjungers](https://community.auth0.com/u/sjungers)\
**Post date:** [January 25, 2021, 4:25pm UTC](https://community.auth0.com/t/multiple-apps-single-api-mixed-oauth-flows/56757/1 "2021-01-25T16:25:57Z")

</div>

Hi, I’m trying to work through the documentation to set up our authorization architecture, and I’m struggling to figure out which of these options will be best.

We have 2 applications that currently share the same client information. They are both MVC applications and use OIDC + authorization\_code flow.

We recently introduced a separate API that these applications will be called and is secured with RBAC (but we are currently not using the authorization extension in Auth0).

We are also introducing a new SPA that handles the administration of the new SPA + provides some APIs for the 2 existing applications to call.

Requirements are:

1. I can use machine-to-machine authorization to call the API with the right roles (scopes)
2. If an end-user is logged into one of the apps, the application can make the appropriate calls to the API with the roles the user has (we’re currently passing the user’s token through, I’m not sure if that’s right, though).
3. The user logged into the spa can call the APIs to administer the data for that application.

We started with a single API definition in Auth0 + a single application/client definition in Auth0, but users were forced to authorize the app in the SPA when they weren’t in the MVC apps. This is all a bit complicated, and I’m not sure if it makes sense to do it this way.

Any help would be greatly appreciated.

---

<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:** [January 25, 2021, 8:45pm UTC](https://community.auth0.com/t/multiple-apps-single-api-mixed-oauth-flows/56757/3 "2021-01-25T20:45:41Z")

</div>

Hi @sjungers,

You should register each app separately (different client id/secret). Let’s say we have a regular web app for admin, a web app for employees, and a SPA for customers. Those would require you set up three different applications/clients in Auth0. Then, if they all send requests to the same API, you would register a single API with Auth0.

You also might want to set up a machine to machine application.

These docs might also help, although they use some outdated flows and SDKs.

> **[Architecture Scenarios](https://auth0.com/docs/get-started/architecture-scenarios)**
>
> Learn about common Auth0 architecture scenarios that you can use to solve your authorization and authentication needs.

---

<div class="post-metadata">

**Author:** ![sjungers](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sjungers/32/19971_2.png) [@sjungers](https://community.auth0.com/u/sjungers)\
**Post date:** [January 25, 2021, 8:58pm UTC](https://community.auth0.com/t/multiple-apps-single-api-mixed-oauth-flows/56757/4 "2021-01-25T20:58:12Z")

</div>

Thanks for the response @dan.woda. So, that’s the approach I was heading towards, but what I’m not sure about is how to do the token validation in the API. We’re using jwt for the access token, and I’m assuming we will want to do audience and signature validation in the API to ensure the token hasn’t been tampered with, right? How can I do that if each application uses a different client-id, client-secret? Would switching to RS256 instead of HS256 allow multiple apps to access the same API?

Sorry, I’ve been so deep in the docs that my eyes are going crossed. Every time I feel like I understand the solution, I come up with a different concern.

---

<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:** [January 25, 2021, 9:06pm UTC](https://community.auth0.com/t/multiple-apps-single-api-mixed-oauth-flows/56757/5 "2021-01-25T21:06:25Z")

</div>

You won’t be able to user symmetric algos in a client side app. (i.e. you can’t use HS256 in a SPA).

Here is a good post that breaks it down:

> [@JWT signing algorithms RS256 vs HS256](https://community.auth0.com/t/jwt-signing-algorithms-rs256-vs-hs256/7720/2):
>
> Both choices refer to what algorithm the identity provider uses to sign the JWT. Signing is a cryptographic operation that generates a “signature” (part of the JWT) that the recipient of the token can validate to ensure that the token has not been tampered with. RS256 (RSA Signature with SHA-256) is an asymmetric algorithm, and it uses a public/private key pair: the identity provider has a private (secret) key used to generate the signature, and the consumer of the JWT gets a public key to val…

In short: _yes_, you will need to use RS 256.

---

<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:** [February 9, 2021, 9:06pm UTC](https://community.auth0.com/t/multiple-apps-single-api-mixed-oauth-flows/56757/6 "2021-02-09T21:06:32Z")

</div>

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