# How to combine spring-boot and react

**URL:** <https://openvidu.discourse.group/t/how-to-combine-spring-boot-and-react/3231>\
**Category:** How to implement?\
**Tags:** v2\
**Created:** [July 20, 2021, 1:36pm UTC](https://openvidu.discourse.group/t/how-to-combine-spring-boot-and-react/3231 "2021-07-20T13:36:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dat\_Pham](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/dat_pham/32/1567_2.png) [@Dat\_Pham](https://openvidu.discourse.group/u/Dat_Pham)\
**Post date:** [July 20, 2021, 1:36pm UTC](https://openvidu.discourse.group/t/how-to-combine-spring-boot-and-react/3231/1 "2021-07-20T13:36:18Z")

</div>

Hi  
I have a project to combine spring-boot and react. I’m using openvidu-js-java to backend and openvidu-insecure-react to frontend. I tried to get a token from backend then sent it to frontend, frontend had token but it didn’t display the camera but my laptop noticed that it displayed camera. How can I fix it?  
In my code. I choose the attribute is “publisher1” and logged  
Thank for answers

 ![image](https://global.discourse-cdn.com/free1/uploads/openvidu/original/2X/6/67a439b7b4acf179f801dcd54f1fdae11f3d3634.png)

---

<div class="post-metadata">

**Author:** ![micael.gallego](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/micael.gallego/32/2_2.png) [@micael.gallego](https://openvidu.discourse.group/u/micael.gallego)\
**Post date:** [July 20, 2021, 3:00pm UTC](https://openvidu.discourse.group/t/how-to-combine-spring-boot-and-react/3231/2 "2021-07-20T15:00:11Z")

</div>

Spring-boot example you are using hasn’t CORS enabled.

Configure CORS in SpringBoot example following this tutorial:

> **[CORS with Spring | Baeldung](https://www.baeldung.com/spring-cors)**
>
> Simple config for CORS with the built-in support in Spring MVC.

Regards

---

<div class="post-metadata">

**Author:** ![Dat\_Pham](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/dat_pham/32/1567_2.png) [@Dat\_Pham](https://openvidu.discourse.group/u/Dat_Pham)\
**Post date:** [July 20, 2021, 4:49pm UTC](https://openvidu.discourse.group/t/how-to-combine-spring-boot-and-react/3231/3 "2021-07-20T16:49:40Z")

</div>

I have a question: I only sent token for the frontend then does it work? Do I need to add connectionId, id, type,… such as data when I only used insecure-react?

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [July 22, 2021, 11:04am UTC](https://openvidu.discourse.group/t/how-to-combine-spring-boot-and-react/3231/4 "2021-07-22T11:04:19Z")

</div>

You only need the token, and call to the `connect` method of the `Session` object: [Session | OpenVidu Browser - v2.18.0](https://docs.openvidu.io/en/2.18.0/api/openvidu-browser/classes/session.html#connect)

---

<div class="post-metadata">

**Author:** ![Dat\_Pham](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/dat_pham/32/1567_2.png) [@Dat\_Pham](https://openvidu.discourse.group/u/Dat_Pham)\
**Post date:** [July 24, 2021, 7:19pm UTC](https://openvidu.discourse.group/t/how-to-combine-spring-boot-and-react/3231/5 "2021-07-24T19:19:49Z")

</div>

I tried to do that but it still doesn’t work, when I check in frontend (unsecure-js) I realize it doesn’t setState at here so it doesn’t display screen

 ![vidu02](https://global.discourse-cdn.com/free1/uploads/openvidu/original/2X/3/306e4566d8a27f36c99207c3e3269ed88231579c.png)

---

<div class="post-metadata">

**Author:** ![micael.gallego](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/micael.gallego/32/2_2.png) [@micael.gallego](https://openvidu.discourse.group/u/micael.gallego)\
**Post date:** [July 24, 2021, 8:30pm UTC](https://openvidu.discourse.group/t/how-to-combine-spring-boot-and-react/3231/6 "2021-07-24T20:30:48Z")

</div>

Take a look to react sample. It should work. Just replace token generation from frontend to backend. Let the rest of the code exactly the same.
