Skip to content

Commit 2fd6047

Browse files
committed
feat: add web app howto.
1 parent e7e973a commit 2fd6047

File tree

5 files changed

+155
-21
lines changed

5 files changed

+155
-21
lines changed

docs/guides/howto/add_web_app.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
id: add_web_app
3+
title: Add a Web Application.
4+
sidebar_label: Add Web App
5+
slug: /guides/howto/add-web-app
6+
description: How to let Crossid know about your Single Page Application (SPA).
7+
---
8+
9+
import AddWebApp from "../../../src/components/AddWebApp.mdx";
10+
11+
### What is an app?
12+
13+
An _app_ represents your application where users logs in.
14+
15+
This explains how to add a web app, used by backends such as _Nodejs_ and _Golang_, etc...
16+
17+
:::note
18+
For other app types, see [application](/docs/concepts/application).
19+
:::
20+
21+
## Adding an app
22+
23+
<AddWebApp/>
24+
25+
Crossid will give you back _client id_ and _client_secret_ to be embedded into your app's code.
26+
27+
## Update your app
28+
29+
Everytime a user tries to login, the app should redirect to Crossid and provide the _client id_.

sidebars.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = {
1313
],
1414
"How-Tos": [
1515
"guides/howto/add_spa_app",
16+
"guides/howto/add_web_app",
1617
"guides/howto/app_user_assignment",
1718
],
1819
},

src/components/AddSpaApp.mdx

+48-21
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,56 @@ curl -X POST \
2424
-H "Authorization: Bearer <API_TOKEN>" \
2525
-d '
2626
{
27-
"type": "singlePageApp",
28-
"data": [
29-
{
30-
"collectorId": "appDetails",
31-
"vars": {
32-
"displayName": "My App",
33-
"appId": "myapp"
34-
}
35-
},
36-
{
37-
"collectorId": "oauth2Client",
38-
"type": "oauth2Client",
39-
"vars": {
40-
"client_id": "myapp",
41-
"redirect_uris": [
42-
"https://localhost/callback"
43-
],
44-
"audience": ["https://localhost"]
27+
"type":"singlePageApp",
28+
"data":[
29+
{
30+
"type":"appManifest",
31+
"collectorId":"appDetails",
32+
"vars":{
33+
"appId":"myspa",
34+
"displayName":"My SPA",
35+
"active":true,
36+
"appLogic":"local",
37+
"types":[
38+
"scimGroup",
39+
"userLink"
40+
]
41+
}
42+
},
43+
{
44+
"type":"info",
45+
"collectorId":"overview",
46+
"vars":{
47+
48+
}
49+
},
50+
{
51+
"type":"default",
52+
"collectorId":"oauth2Client",
53+
"vars":{
54+
"grant_types":[
55+
"authorization_code"
56+
],
57+
"response_types":[
58+
"code"
59+
],
60+
"scope":"openid offline profile email",
61+
"token_endpoint_auth_method":"none",
62+
"allow_refresh_token":false,
63+
"redirect_uris":[
64+
"https://localhost/callback"
65+
],
66+
"post_logout_redirect_uris":[
67+
"https://localhost/callback"
68+
],
69+
"allowed_cors_origins":[
70+
"https://localhost*"
71+
]
72+
}
4573
}
46-
}
47-
]
74+
]
4875
}
49-
' https://{tenant}.crossid.io/api/v1/apps/.provision/?reason=sample-app
76+
' https://{tenant}.crossid.io/api/v1/integrations/.provision/?reason=sample-app
5077
```
5178

5279
</TabItem>

src/components/AddWebApp.mdx

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import Tabs from "@theme/Tabs";
2+
import TabItem from "@theme/TabItem";
3+
4+
<Tabs
5+
defaultValue="console"
6+
values={[
7+
{label: 'Console', value: 'console'},
8+
{label: 'Curl', value: 'curl'}
9+
]}>
10+
<TabItem value="console">
11+
12+
1. In Admin console, navigate to <b>Integration &rarr; Marketplace</b>.
13+
1. Choose <b>Web Page Application</b>.
14+
1. Click on <b>Add Integration</b>.
15+
1. Follow wizard steps.
16+
17+
![how-to](/img/add_web_app.gif)
18+
19+
</TabItem>
20+
<TabItem value="curl">
21+
22+
```bash {10-11,18-22}
23+
curl -X POST \
24+
-H "Authorization: Bearer <API_TOKEN>" \
25+
-d '
26+
{
27+
"type":"webApp",
28+
"data":[
29+
{
30+
"type":"appManifest",
31+
"collectorId":"appDetails",
32+
"vars":{
33+
"appId":"mynodeapp",
34+
"displayName":"My Node App",
35+
"active":true,
36+
"appLogic":"scimv2",
37+
"types":[
38+
"scimGroup",
39+
"userLink"
40+
]
41+
}
42+
},
43+
{
44+
"type":"info",
45+
"collectorId":"overview",
46+
"vars":{
47+
48+
}
49+
},
50+
{
51+
"type":"default",
52+
"collectorId":"oauth2Client",
53+
"vars":{
54+
"grant_types":[
55+
"authorization_code"
56+
],
57+
"response_types":[
58+
"code",
59+
"id_token",
60+
"code id_token"
61+
],
62+
"scope":"openid offline profile email",
63+
"redirect_uris":[
64+
"https://localhost/callback"
65+
],
66+
"post_logout_redirect_uris":[
67+
"https://localhost/callback"
68+
]
69+
}
70+
}
71+
]
72+
}
73+
' https://{tenant}.crossid.io/api/v1/integrations/.provision/?reason=sample-app
74+
```
75+
76+
</TabItem>
77+
</Tabs>

static/img/add_web_app.gif

1.84 MB
Loading

0 commit comments

Comments
 (0)