Skip to content

Instantly share code, notes, and snippets.

@jakerobers
Created April 19, 2020 16:10
Show Gist options
  • Save jakerobers/13f372882294755c068c4008a723b9b1 to your computer and use it in GitHub Desktop.
Save jakerobers/13f372882294755c068c4008a723b9b1 to your computer and use it in GitHub Desktop.
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