# Web (React), mobile (React-Native), API backend (Express) architecture

**URL:** <https://community.auth0.com/t/web-react-mobile-react-native-api-backend-express-architecture/98115>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [January 13, 2023, 6:35am UTC](https://community.auth0.com/t/web-react-mobile-react-native-api-backend-express-architecture/98115 "2023-01-13T06:35:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AABloom](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aabloom/32/42610_2.png) [@AABloom](https://community.auth0.com/u/AABloom)\
**Post date:** [January 13, 2023, 6:35am UTC](https://community.auth0.com/t/web-react-mobile-react-native-api-backend-express-architecture/98115/1 "2023-01-13T06:35:49Z")

</div>

Hey,  
I’m trying to set up the following architecture:

1. React-Native mobile client
2. React web client
3. Express server for API calls  
The users will be able to log-in on either or both of the clients, and both clients need to be able to access the server APIs after being authenticated.

I’m struggling with mainly 2 questions:

1. how many Auth0 applications/APIs do I need here? one for each client&server? do I need to create APIs for this?
2. how should the clients get the tokens for making the authenticated API requests? is it a token that the clients get when the user logs in, or do the clients need to make some new requests to Auth0 to generate a token for the API requests?

Thanks!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 14, 2023, 2:04am UTC](https://community.auth0.com/t/web-react-mobile-react-native-api-backend-express-architecture/98115/3 "2023-01-14T02:04:54Z")

</div>

Hey there @AABloom welcome to the community!

> [@AABloom](#):
>
> how many Auth0 applications/APIs do I need here? one for each client&server? do I need to create APIs for this?

It sounds like you will need to register 3 applications in Auth0 (1 Native, 1 SPA, and 1 Web) as well as 1 registered API.

> [@AABloom](#):
>
> how should the clients get the tokens for making the authenticated API requests? is it a token that the clients get when the user logs in, or do the clients need to make some new requests to Auth0 to generate a token for the API requests?

That’s correct - Upon successful authentication/authorization users will typically receive an ID token and Access token. The ID token contains information about the user (authenticated) and the Access token will contain scopes, roles, permissions etc. and is validated by your backend/API.

The following architecture scenario docs may be a good place to start in order to get a general overview of what this may look like:

> **[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.

I also definitely recommend exploring our [sample apps](https://github.com/auth0-samples) and [quickstarts](https://auth0.com/docs/quickstarts) as there are basic examples of all technologies you are working with.

Let us know if you have any follow up questions, but it sounds like you are on the right track! 🚀

---

<div class="post-metadata">

**Author:** ![AABloom](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/aabloom/32/42610_2.png) [@AABloom](https://community.auth0.com/u/AABloom)\
**Post date:** [January 14, 2023, 7:34pm UTC](https://community.auth0.com/t/web-react-mobile-react-native-api-backend-express-architecture/98115/4 "2023-01-14T19:34:35Z")

</div>

Thanks for the quick and details response @ty.frith,  
The applications and the API make total sense, what I’m still not sure about tho is upon successful authentication/authorization on the clients (web or mobile), will I get the Access token as a response to the authorization call (and will be able to use it to authenticate the API call to the server), or will I have to call another Auth0 API (like ‘/oauth’) to get this Access token for the API calls?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 17, 2023, 4:06pm UTC](https://community.auth0.com/t/web-react-mobile-react-native-api-backend-express-architecture/98115/5 "2023-01-17T16:06:29Z")

</div>

Hey @AABloom no problem, happy to help!

> [@AABloom](#):
>
> will I get the Access token as a response to the authorization call (and will be able to use it to authenticate the API call to the server),

That’s exactly correct! Upon successful authentication/authorization a user will receive ID/Access tokens for which the Access token is to be used against your API. This [doc](https://auth0.com/docs/get-started/authentication-and-authorization-flow#authorization-code-flow) provides a good outline of the different flows - In particular I recommend checking out the PKCE flow as it will most likely be used for both a SPA and mobile (native) app:

> **[Authorization Code Flow with Proof Key for Code Exchange (PKCE)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-proof-key-for-code-exchange-pkce)**
>
> Learn how the Authorization Code flow with Proof Key for Code Exchange (PKCE) works and why you should use it for native and mobile apps.

---

<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:** [January 31, 2023, 4:07pm UTC](https://community.auth0.com/t/web-react-mobile-react-native-api-backend-express-architecture/98115/6 "2023-01-31T16:07:25Z")

</div>

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