Created
April 19, 2020 16:10
-
-
Save jakerobers/13f372882294755c068c4008a723b9b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import createVendorAuthClient, { VendorAuthClient } from 'someauthservice'; | |
import { AuthService } from './authService' | |
import { VendorSession, Session } from '../../models/session' | |
export default class VendorAuthService implements AuthService { | |
client: VendorAuthClient; | |
redirectUri: string; | |
constructor() { | |
this.client = createVendorAuthClient() | |
this.redirectUri = process.env.REACT_APP_REDIRECT_URI | |
} | |
async login() { | |
return this.client.loginWithRedirect({ redirect_uri: this.redirectUri }); | |
} | |
async logout() { | |
return this.client.logout({ returnTo: this.redirectUri }); | |
} | |
async isAuthenticated() { | |
return client.isAuthenticated(); | |
} | |
async getJwtToken() { | |
return this.client.getToken() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment