Skip to content

Commit f4beb63

Browse files
authored
fix: update in-page login oauth uri (#175)
* fix: update in-page-login oauth uri * update version in package * update docs
1 parent cca1fb8 commit f4beb63

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

docs/sso-login-mode.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ RingCentral Embeddable is a whole front-end application, it doesn't need backend
1111

1212
Firstly, developer should implement the OAuth authorization code flow in own web server. When user goes to developer's website, it should show a ringcentral login button in web page to allow user to login with his RingCentral account to connect RingCentral services. So server can get the RingCentral API token and save it in backend connecting current login user.
1313

14-
## Inject RingCentral Embeddable with sso mode
14+
## Inject RingCentral Embeddable with in-page mode
1515

16-
After user logins success by developer's authorization code flow, developer should inject the widget with sso mode and pass same `appKey` to the widget as previous authorization code flow.
16+
After user logins success by developer's authorization code flow, developer should inject the widget with in-page mode and pass same `appKey` to the widget as previous authorization code flow.
1717

1818
### Use adapter way:
1919

@@ -35,4 +35,4 @@ After user logins success by developer's authorization code flow, developer shou
3535
</iframe>
3636
```
3737

38-
With auth sso mode, the widget will use implicit flow and it will redirect to RingCentral OAuth uri if the widget haven't been logined. Because user have logined in previous flow, RingCentral OAuth server will redirect back to the widget with access token. So the widget will be logined without filling password again.
38+
With auth In-page mode, the widget will use **implicit flow** and it will redirect to RingCentral OAuth uri if the widget haven't been logined. Because user have logined in previous flow, RingCentral OAuth server will redirect back to the widget with access token. So the widget will be logined without filling password again.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ringcentral-embeddable",
3-
"version": "0.0.1",
3+
"version": "0.1.3",
44
"description": "A RingCentral Embeddable Widget Application",
55
"main": "index.js",
66
"license": "MIT",

src/modules/OAuth/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default class OAuth extends ProxyFrameOAuth {
3636
_createSSOIframe() {
3737
this._clearSSOIframe();
3838
this._ssoFrame = document.createElement('iframe');
39-
this._ssoFrame.src = this.oAuthUri;
39+
this._ssoFrame.src = this.implictRefreshOAuthUri;
4040
this._ssoFrame.name = 'SSOIframe';
4141
this._ssoFrame.style.zIndex = 100;
4242
this._ssoFrame.style.display = 'block';
@@ -87,11 +87,18 @@ export default class OAuth extends ProxyFrameOAuth {
8787
switch (error.message) {
8888
case 'invalid_request':
8989
case 'unauthorized_client':
90-
case 'access_denied':
9190
case 'unsupported_response_type':
9291
case 'invalid_scope':
9392
message = authMessages.accessDenied;
9493
break;
94+
case 'access_denied': {
95+
if (this.authMode === 'sso' && this._ssoFrame) {
96+
this._clearSSOIframe();
97+
} else {
98+
message = authMessages.accessDenied;
99+
}
100+
break;
101+
}
95102
case 'server_error':
96103
case 'temporarily_unavailable':
97104
default:

0 commit comments

Comments
 (0)