Functioning login process.

This commit is contained in:
Patrick Fic
2019-12-06 14:24:36 -08:00
parent 78c43fa1e5
commit 1176b62d0b
24 changed files with 354 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp(functions.config().firebase);
const fetch = require("node-fetch");
//Todo: Move this to an environment parameter.
const GRAPHQL_ENDPOINT = functions.config().auth.graphql_endpoint;
@@ -50,22 +49,19 @@ exports.processSignUp = functions.auth.user().onCreate(user => {
}
};
}
//update the AuthId in the graphql server.
fetch(GRAPHQL_ENDPOINT, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"x-hasura-admin-secret": HASURA_SECRET_ADMIN_KEY
},
body: JSON.stringify({
query: UPSERT_USER,
variables: { authEmail: user.email, authToken: user.uid }
})
});
// .then(r => r.json())
// .then(data => {
// console.log("data returned:", data);
//Removed for now - outbound connections are not free on firebase.
// fetch(GRAPHQL_ENDPOINT, {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// Accept: "application/json",
// "x-hasura-admin-secret": HASURA_SECRET_ADMIN_KEY
// },
// body: JSON.stringify({
// query: UPSERT_USER,
// variables: { authEmail: user.email, authToken: user.uid }
// })
// });
// Set custom user claims on this newly created user.