You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-4Lines changed: 37 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Java React Sample App
1
+
# Java React Sample App
2
2
3
-
This sample app showcases Descope authentication built using React for frontend and Java Spring for backend. The frontend incldues a home, login, and dashboard screen, with the dashboard including a call to the backend to get a "secret message" that is only shared when a valid session token is passed in.
3
+
This sample app showcases Descope authentication built using React for frontend and Java Spring for backend. The frontend incldues a home, login, and dashboard screen, with the dashboard including a call to the backend to get a "secret message" that is only shared when a valid session token is passed in.
4
4
5
5
Authentication and session validation are implemented using Descope's [React SDK](https://github.com/descope/react-sdk) and [Java SDK](https://github.com/descope/descope-java) in the frontend and backend respectively.
6
6
@@ -9,11 +9,13 @@ Authentication and session validation are implemented using Descope's [React SDK
9
9
### Run server
10
10
11
11
1. Navigate into the server folder:
12
+
12
13
```
13
14
cd server
14
15
```
15
16
16
17
2. In your `application.properties` file, add your Descope project ID:
18
+
17
19
```
18
20
descope.project.id=<YOUR_DESCOPE_PROJECT_ID>
19
21
```
@@ -30,34 +32,65 @@ If you use Maven, run the following command in a terminal window (in the complet
30
32
./mvnw spring-boot:run
31
33
```
32
34
33
-
34
35
### Run client
35
36
36
37
1. Navigate into the client folder:
38
+
37
39
```
38
40
cd client
39
41
```
40
42
41
43
2. Install dependencies
44
+
42
45
```
43
46
npm i
44
47
```
45
48
46
49
3. Create a `.env` folder and add environment variables:
>Note: If you're not running the client at http://localhost:3000 you may need to change the server's CrossOrigin domain to wherever you're hosting it (in JavaSampleAppApplication.java).
61
+
>Note: If you're not running the client at <http://localhost:3000> you may need to change the server's CrossOrigin domain to wherever you're hosting it (in JavaSampleAppApplication.java).
62
+
57
63
```
58
64
@CrossOrigin(origins = "http://localhost:3000")
59
65
```
60
66
67
+
## Tenant-based OIDC SSO Setup
68
+
69
+
You will need to configure a tenant in your Descope console with OIDC. Then, you can use the associated tenant ID to start SSO, redirect to the IdP authentication portal, and then exchange the returned code for
70
+
authenticated user info. We'll include the steps to set up in the UI here, but this can also be done via API or SDK.
71
+
72
+
1. Create a tenant [here](https://app.descope.com/tenants)
73
+
2. Then, click on the tenant, Authentication Methods, SSO and enable and configure SSO via OIDC with an Identity Provider
74
+
75
+
Be sure to have `https://api.descope.com/v1/oauth/callback` in the allowed redirect URIs
76
+
77
+

78
+
79
+
3. Run your application per `Setup & Running` as described above, with the client at http://localhost:3000 and server at http://localhost:8080.
80
+
81
+
4. Navigate to the url where your client is running and input the tenant ID.
82
+
83
+

84
+
85
+
5. Log in via your IdP. Then, you'll be redirected back to the application where the SSO exchange will complete.
86
+
87
+

88
+
89
+
You should see the signed in user's email, userId, session, and refresh token.
90
+

91
+
92
+
93
+
61
94
## License
62
95
63
96
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
0 commit comments