Github Auth to use AuthSessionStore

This commit is contained in:
Raghunandan
2020-06-26 13:56:03 +02:00
committed by Fredrik Adelöw
parent a306bf2c27
commit 0d8cc6561f
2 changed files with 12 additions and 2 deletions
@@ -27,7 +27,10 @@ import {
} from '../../../definitions/auth';
import { OAuthRequestApi, AuthProvider } from '../../../definitions';
import { SessionManager } from '../../../../lib/AuthSessionManager/types';
import { StaticAuthSessionManager } from '../../../../lib/AuthSessionManager';
import {
AuthSessionStore,
StaticAuthSessionManager,
} from '../../../../lib/AuthSessionManager';
import { Observable } from '../../../../types';
type CreateOptions = {
@@ -91,7 +94,13 @@ class GithubAuth implements OAuthApi, SessionStateApi {
sessionScopes: (session: GithubSession) => session.providerInfo.scopes,
});
return new GithubAuth(sessionManager);
const authSessionStore = new AuthSessionStore<GithubSession>({
manager: sessionManager,
storageKey: 'githubSession',
sessionScopes: (session: GithubSession) => session.providerInfo.scopes,
});
return new GithubAuth(authSessionStore);
}
sessionState$(): Observable<SessionState> {
@@ -16,4 +16,5 @@
export { RefreshingAuthSessionManager } from './RefreshingAuthSessionManager';
export { StaticAuthSessionManager } from './StaticAuthSessionManager';
export { AuthSessionStore } from './AuthSessionStore';
export * from './types';