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: docs/additional-documentation/configure-library-for-implicit-flow-without-discovery-document.html
+2-1
Original file line number
Diff line number
Diff line change
@@ -43,11 +43,12 @@
43
43
44
44
45
45
46
+
46
47
47
48
48
49
49
50
50
-
<h1id="configure-library-for-implicit-flow-without-discovery-document-">Configure Library for Implicit Flow (without discovery document)</h1>
51
+
<h1id="configure-library-for-implicit-flow-without-discovery-document">Configure Library for Implicit Flow (without discovery document)</h1>
51
52
<p>When you don't have a discovery document, you have to configure more properties manually:</p>
52
53
<p>Please note that the following sample uses the original config API. For information about the new config API have a look to the project's README above.</p>
Copy file name to clipboardExpand all lines: docs/additional-documentation/preserving-state-(like-the-requested-url).html
+2-1
Original file line number
Diff line number
Diff line change
@@ -43,11 +43,12 @@
43
43
44
44
45
45
46
+
46
47
47
48
48
49
49
50
50
-
<h1id="preserving-state-like-the-requested-url-">Preserving State (like the Requested URL)</h1>
51
+
<h1id="preserving-state-like-the-requested-url">Preserving State (like the Requested URL)</h1>
51
52
<p>When calling <code>initImplicitFlow</code>, you can pass an optional state which could be the requested url:</p>
52
53
<div><preclass="line-numbers"><codeclass="language-TypeScript">this.oauthService.initImplicitFlow('http://www.myurl.com/x/y/z');</code></pre></div><p>After login succeeded, you can read this state:</p>
Copy file name to clipboardExpand all lines: docs/additional-documentation/refreshing-a-token.html
+4-3
Original file line number
Diff line number
Diff line change
@@ -43,14 +43,15 @@
43
43
44
44
45
45
46
+
46
47
47
48
48
49
49
50
50
51
<h1id="refreshing-a-token">Refreshing a Token</h1>
51
52
<p>The strategy to use for refreshing your token differs between implicit flow and code flow. Hence, you find here one separate section for both of them.</p>
52
53
<p>The last section shows how to automate refreshing for both flows.</p>
53
-
<h2id="refreshing-when-using-code-flow-not-implicit-flow-">Refreshing when using Code Flow (not Implicit Flow!)</h2>
54
+
<h2id="refreshing-when-using-code-flow-not-implicit-flow">Refreshing when using Code Flow (not Implicit Flow!)</h2>
54
55
<blockquote>
55
56
<blockquote>
56
57
<p>For refreshing a token with implicit flow, please see section below!</p>
@@ -59,7 +60,7 @@ <h2 id="refreshing-when-using-code-flow-not-implicit-flow-">Refreshing when usin
59
60
<p>When using code flow, you can get an <code>refresh_token</code>. While the original standard DOES NOT allow this for SPAs, the mentioned document proposes to ease this limitation. However, it specifies a list of requirements one should take care about before using refresh_tokens. Please make sure you respect those requirements.</p>
60
61
<p>Please also note, that you have to request the <code>offline_access</code> scope to get an refresh token.</p>
61
62
<p>To refresh your token, just call the <code>refresh</code> method:</p>
62
-
<div><preclass="line-numbers"><codeclass="language-typescript">this.oauthService.refresh();</code></pre></div><h2id="refreshing-when-using-implicit-flow-not-code-flow-">Refreshing when using Implicit Flow (not Code Flow!)</h2>
63
+
<div><preclass="line-numbers"><codeclass="language-typescript">this.oauthService.refresh();</code></pre></div><h2id="refreshing-when-using-implicit-flow-not-code-flow">Refreshing when using Implicit Flow (not Code Flow!)</h2>
63
64
<p>To refresh your tokens when using implicit flow you can use a silent refresh. This is a well-known solution that compensates the fact that implicit flow does not allow for issuing a refresh token. It uses a hidden iframe to get another token from the auth server. When the user is there still logged in (by using a cookie) it will respond without user interaction and provide new tokens.</p>
64
65
<p>To use this approach, setup a redirect uri for the silent refresh.</p>
65
66
<p>For this, you can set the property silentRefreshRedirectUri in the config object:</p>
@@ -103,7 +104,7 @@ <h2 id="refreshing-when-using-code-flow-not-implicit-flow-">Refreshing when usin
.catch(err => console.error('refresh error', err));</code></pre></div><p>When there is an error in the iframe that prevents the communication with the main application, silentRefresh will give you a timeout. To configure the timespan for this, you can set the property <code>silentRefreshTimeout</code> (msec). The default value is 20.000 (20 seconds).</p>
106
-
<h3id="automatically-refreshing-a-token-when-before-it-expires-code-flow-and-implicit-flow-">Automatically refreshing a token when/ before it expires (Code Flow and Implicit Flow)</h3>
107
+
<h3id="automatically-refreshing-a-token-when-before-it-expires-code-flow-and-implicit-flow">Automatically refreshing a token when/ before it expires (Code Flow and Implicit Flow)</h3>
107
108
<p>To automatically refresh a token when/ some time before it expires, just call the following method after configuring the OAuthService:</p>
108
109
<div><preclass="line-numbers"><codeclass="language-TypeScript">this.oauthService.setupAutomaticSilentRefresh();</code></pre></div><p>By default, this event is fired after 75% of the token's life time is over. You can adjust this factor by setting the property <code>timeoutFactor</code> to a value between 0 and 1. For instance, 0.5 means, that the event is fired after half of the life time is over and 0.33 triggers the event after a third.</p>
<p>This section shows how to use the password flow, which demands the user to directly enter his or her password into the client.</p>
52
53
<p>Please note that from an OAuth2/OIDC perspective, the implicit flow is better suited for logging into a SPA and the flow described here should only be used,
53
54
when a) there is a strong trust relations ship between the client and the auth server and when b) other flows are not possible.</p>
54
-
<h2id="configure-library-for-password-flow-using-discovery-document-">Configure Library for Password Flow (using discovery document)</h2>
55
+
<h2id="configure-library-for-password-flow-using-discovery-document">Configure Library for Password Flow (using discovery document)</h2>
55
56
<p>To configure the library you just have to set some properties on startup. For this, the following sample uses the constructor of the AppComponent which is called before routing kicks in.</p>
56
57
<p>Please not, that this configuration is quite similar to the one for the implcit flow.</p>
}</code></pre></div><h2id="fetching-an-access-token-by-providing-the-current-user-s-credentials">Fetching an Access Token by providing the current user's credentials</h2>
120
+
}</code></pre></div><h2id="fetching-an-access-token-by-providing-the-current-users-credentials">Fetching an Access Token by providing the current user's credentials</h2>
0 commit comments