Skip to content

Instantly share code, notes, and snippets.

View mars3142's full-sized avatar
👨‍💻
Building awesome stuff

Peter Siegmund mars3142

👨‍💻
Building awesome stuff
View GitHub Profile
extends Control
var _api_key = "secret"
var _api_url = "https://project_id.cloudfunctions.net/api"
onready var _username = $vb/input_area/username
onready var _password = $vb/input_area/password
func _ready() -> void:
@mars3142
mars3142 / backend.js
Created June 9, 2021 20:13
create token
async function sendToken(res: Response, username: string) {
const token = await auth().createCustomToken(username);
res.status(200).json({
data: {
username: username,
token: token,
},
});
}
router.post("/signin", async (req, res) => {
const username = req.body.username;
const password = req.body.password;
if (await isUserValid(username, password)) {
await sendToken(res, username);
} else {
res.status(401).json({
error: {
message: "Username or password invalid",
router.post("/signup", async (req, res) => {
const username = req.body.username;
const password = req.body.password;
if (username !== undefined && username.trim().length > 0) {
const user = await database().ref(`accounts/${username}`).get();
if (user.exists()) {
res.status(400).json({
error: {
message: "Username already exists",

Keybase proof

I hereby claim:

  • I am mars3142 on github.
  • I am mars3142 (https://keybase.io/mars3142) on keybase.
  • I have a public key whose fingerprint is B064 6F6F FE19 CB8E 62E3 FBA4 F7CC 8BA2 8852 21B0

To claim this, I am signing this object: