Skip to content

Commit bc6c4e1

Browse files
Add documentation for loadDisco....And...() functions
1 parent 08210ca commit bc6c4e1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

projects/lib/src/oauth-service.ts

+14
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,26 @@ export class OAuthService extends AuthConfig {
168168
this.restartRefreshTimerIfStillLoggedIn();
169169
}
170170

171+
/**
172+
* Convenience method that first calls `loadDiscoveryDocument(...)` and
173+
* directly chains using the `then(...)` part of the promise to call
174+
* the `tryLogin(...)` method.
175+
*
176+
* @param options LoginOptions to pass through to `tryLogin(...)`
177+
*/
171178
public loadDiscoveryDocumentAndTryLogin(options: LoginOptions = null) {
172179
return this.loadDiscoveryDocument().then(doc => {
173180
return this.tryLogin(options);
174181
});
175182
}
176183

184+
/**
185+
* Convenience method that first calls `loadDiscoveryDocumentAndTryLogin(...)`
186+
* and if then chains to `initImplicitFlow()`, but only if there is no valid
187+
* IdToken or no valid AccessToken.
188+
*
189+
* @param options LoginOptions to pass through to `tryLogin(...)`
190+
*/
177191
public loadDiscoveryDocumentAndLogin(options: LoginOptions = null) {
178192
return this.loadDiscoveryDocumentAndTryLogin(options).then(_ => {
179193
if (!this.hasValidIdToken() || !this.hasValidAccessToken()) {

0 commit comments

Comments
 (0)