dev-utils: add google and github auth APIs to default api factories

This commit is contained in:
Patrik Oldsberg
2020-06-23 21:25:40 +02:00
parent cd7c1efb13
commit c6b9d27a71
@@ -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,
}),
});