From c6b9d27a71a7d5e4842d000a4dc726772e49aeb7 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 23 Jun 2020 21:25:40 +0200 Subject: [PATCH] dev-utils: add google and github auth APIs to default api factories --- packages/dev-utils/src/devApp/apiFactories.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/dev-utils/src/devApp/apiFactories.ts b/packages/dev-utils/src/devApp/apiFactories.ts index 967918d87a..7ac6aff261 100644 --- a/packages/dev-utils/src/devApp/apiFactories.ts +++ b/packages/dev-utils/src/devApp/apiFactories.ts @@ -24,6 +24,10 @@ import { AlertApiForwarder, oauthRequestApiRef, OAuthRequestManager, + GoogleAuth, + googleAuthApiRef, + GithubAuth, + githubAuthApiRef, } from '@backstage/core'; // TODO(rugvip): We should likely figure out how to reuse all of these between apps @@ -49,3 +53,25 @@ export const oauthRequestApiFactory = createApiFactory({ deps: {}, factory: () => new OAuthRequestManager(), }); + +export const googleAuthApiFactory = createApiFactory({ + implements: googleAuthApiRef, + deps: { oauthRequestApi: oauthRequestApiRef }, + factory: ({ oauthRequestApi }) => + GoogleAuth.create({ + apiOrigin: 'http://localhost:7000', + basePath: '/auth/', + oauthRequestApi, + }), +}); + +export const githubAuthApiFactory = createApiFactory({ + implements: githubAuthApiRef, + deps: { oauthRequestApi: oauthRequestApiRef }, + factory: ({ oauthRequestApi }) => + GithubAuth.create({ + apiOrigin: 'http://localhost:7000', + basePath: '/auth/', + oauthRequestApi, + }), +});