Skip to content

Commit 3077c70

Browse files
authored
feat: throw error when app client id is empty (#299)
* feat: throw error when app client id is empty * update docs * update docs * fix typo
1 parent c1d31ae commit 3077c70

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ You can use the config tool in this [page](https://ringcentral.github.io/ringcen
4848

4949
#### Stable version
5050

51-
We provide latest RingCentral Embeddable version on github page `https://ringcentral.github.io/ringcentral-embeddable`. It includes latest features and bugfix in RingCentral Embeddable. And it will keep up to date with master codes. But we **recommend** developers to use versioned RingCentral Embeddable. Current latest stable version of RingCentral Embeddable is `0.1.1`. You can get versioned app in this uri `https://apps.ringcentral.com/integration/ringcentral-embeddable/0.1.1`.
51+
We provide latest RingCentral Embeddable version on github page `https://ringcentral.github.io/ringcentral-embeddable`. It includes latest features and bugfix in RingCentral Embeddable. And it will keep up to date with master codes. But we **recommend** developers to use versioned RingCentral Embeddable. Current latest stable version of RingCentral Embeddable is `1.0.1`. You can get versioned app in this uri `https://apps.ringcentral.com/integration/ringcentral-embeddable/1.0.1`.
5252

5353
Just replace `https://ringcentral.github.io/ringcentral-embeddable` in upper codes to the versioned uri, and you will be using versioned RingCentral Embeddable. The versioned app will not be influenced when new features are added, so it will be more stable than latest version. When you need to update RingCentral Embeddable, you need to update the versioned app uri in your codes manually.
5454

docs/config-client-id-and-secret.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Using your own RingCentrall app client id and client secret
22

3-
Developer can config the Web Widget to use their own RingCentral app client id and client secret.
3+
Developer should config the Widget to use their own RingCentral app client id and client secret.
44

55
1. Create a [RingCentral developer free account](https://developer.ringcentral.com)
66
2. Create a RingCentral app with platform type - "Browser Based"
@@ -20,7 +20,7 @@ Developer can config the Web Widget to use their own RingCentral app client id a
2020
</script>
2121
```
2222

23-
`appSecret` is optional. If you provide `appSecret` to the Widget, it will use authorization code flow. If not, it will use implicit grant flow to log in.
23+
`appSecret` is optional. If you provide `appSecret` to the Widget, it will use authorization code flow. If not, it will use implicit grant flow to log in. In implicit flow, if user is inactive in 1 hour, login session will be expired. In authorization code flow, if user is inactive in 7 days, login session will be expired.
2424

2525
## Iframe way
2626

docs/get-started.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ Create a iframe with the following codes:
2626
</iframe>
2727
```
2828

29-
You can also customize the Widget to use your RingCentral app client id and client secrect in [here](config-client-id-and-secret.md).
30-
3129
#### Stable version
3230

33-
We provide latest RingCentral Embeddable version on github page `https://ringcentral.github.io/ringcentral-embeddable`. It includes latest features and bugfix in RingCentral Embeddable. And it will keep up to date with master codes. But we **recommend** developers to use versioned RingCentral Embeddable. Current latest stable version of RingCentral Embeddable is `0.1.0`. You can get `0.1.0` app in this uri `https://apps.ringcentral.com/integration/ringcentral-embeddable/0.1.0`.
31+
We provide latest RingCentral Embeddable version on github page `https://ringcentral.github.io/ringcentral-embeddable`. It includes latest features and bugfix in RingCentral Embeddable. And it will keep up to date with master codes. But we **recommend** developers to use versioned RingCentral Embeddable. Current latest stable version of RingCentral Embeddable is `1.0.1`. You can get `1.0.1` app in this uri `https://apps.ringcentral.com/integration/ringcentral-embeddable/1.0.1`.
3432

3533
Just replace `https://ringcentral.github.io/ringcentral-embeddable` in docs to the versioned uri, and you will be using versioned RingCentral Embeddable. The versioned app will not be influenced when new features are added, so it will be more stable than latest version. When you need to update RingCentral Embeddable, you need to update the versioned app uri in your codes manually.
3634

@@ -48,3 +46,7 @@ Example scripts with versioned app:
4846
})();
4947
</script>
5048
```
49+
50+
## Important
51+
52+
**Before going to production, you should setup the widget to use your own RingCentral app client id and client secrect by following [here](config-client-id-and-secret.md). And use stable version Embeddable**

src/app.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ const apiConfig = {
1919
server: pathParams.appServer || defaultApiConfig.server,
2020
};
2121

22+
if (apiConfig.appKey && apiConfig.appKey === defaultApiConfig.appKey) {
23+
console.warn('Default RingCentral client id is deprecated, it is required to setup your own RingCentral Client Id, Please stop using it soon before it is completely removed. Please follow here to setup your own RingCentral app client id: https://github.com/ringcentral/ringcentral-embeddable/blob/master/docs/config-client-id-and-secret.md');
24+
}
25+
if (!apiConfig.appKey) {
26+
console.error('From v1.0.2, It is required to setup your own RingCentral Client Id. Please follow here to setup your own RingCentral app client id: https://github.com/ringcentral/ringcentral-embeddable/blob/master/docs/config-client-id-and-secret.md');
27+
// don't throw error in PR tests
28+
if (window.location.hostname !== 'localhost') {
29+
throw new Error('RingCentral App Client Id is required.');
30+
}
31+
}
32+
2233
const appVersion = pathParams.appVersion || process.env.APP_VERSION;
2334

2435
const {

0 commit comments

Comments
 (0)