Start work on firebase OAuth

This commit is contained in:
Bradley Schofield
2023-07-28 15:20:46 +01:00
parent cee7726652
commit 5d2aace1a1
2 changed files with 22 additions and 3 deletions
+3 -2
View File
@@ -9,6 +9,7 @@ import {
Functions,
Health,
Locale,
Migrations,
Projects,
Storage,
Teams,
@@ -34,8 +35,8 @@ const sdkForProject = {
project: new Project(clientProject),
storage: new Storage(clientProject),
teams: new Teams(clientProject),
users: new Users(clientProject)
// migrations: new Migrations(clientProject)
users: new Users(clientProject),
migrations: new Migrations(clientProject)
};
export const getSdkForProject = (projectId: string) => {
@@ -3,6 +3,8 @@
import { Button, FormList, InputNumber, InputPassword, InputText } from '$lib/elements/forms';
import { WizardStep } from '$lib/layout';
import type { Provider } from '$lib/stores/migration';
import { sdk } from '$lib/stores/sdk';
import { page } from '$app/stores';
import { provider } from '.';
const providers: Record<Provider, string> = {
@@ -12,6 +14,22 @@
nhost: 'NHost'
};
function connectGoogle() {
const redirect = new URL($page.url);
const target = new URL(
`${sdk.forProject.client.config.endpoint}/migrations/firebase/connect`
);
target.searchParams.set('projectId', $page.params.project);
target.searchParams.set('redirect', redirect.toString());
return target;
}
// function getFirebaseProjects() {
// sdk.forProject.migrations.listFirebaseProjects().then((res) => {
// console.log(res);
// });
// }
let showAuth = false;
</script>
@@ -59,7 +77,7 @@
{:else if $provider.provider === 'firebase'}
<div class="box u-flex u-flex-vertical u-gap-16 u-cross-center u-margin-block-start-24">
<p class="u-text-center u-bold">Sign in with Google to get started</p>
<Button secondary>
<Button secondary href={connectGoogle().toString()}>
<SvgIcon name="google" />Sign in
</Button>
</div>