Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/garrettmflynn/accounts
FOSS account management system for the Brains@Play ecosystem
https://github.com/garrettmflynn/accounts
Last synced: about 1 month ago
JSON representation
FOSS account management system for the Brains@Play ecosystem
- Host: GitHub
- URL: https://github.com/garrettmflynn/accounts
- Owner: garrettmflynn
- License: agpl-3.0
- Created: 2021-12-31T19:57:35.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-21T18:41:30.000Z (almost 3 years ago)
- Last Synced: 2024-10-23T00:15:20.503Z (2 months ago)
- Language: TypeScript
- Size: 201 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# accounts
FOSS account management system for the Brains@Play ecosystem## Features
- [x] Account creation
- [x] Login / Logout
- [x] Add arbitrary fields to your users in `customUserData`
- [x] Delete user data from database### Quick Start
[Install Node LTS](https://nodejs.org/en/download/) (v16 as of writing).```sh
git pull https://github.com/brainsatplay/accounts/
cd accounts
yarn && yarn start
```
This project uses yarn for better monorepo support. If yarn is not installed run:```sh
npm i yarn -g
```> **Note:** The examples in this project assume that you have created a `.key` file to hold your secret keys for each environment (e.g. `development.key`, `production.key`). This file should include a `DB_URI` to reference your MongoDB database.
#### Frontend
```typescript
import AccountsAPI from '../src/frontend'
const accounts = new AccountsAPI("myapp-name")// Login with a Test User Account
accounts.login({email: '[email protected]', password:'test'})
.then(console.log)
.catch(console.error) // expect to sign up first...```
#### Backend
```typescript
import * as api from '@brainsatplay/accounts-node'
import express from 'express'
import mongoose from 'mongoose'
import { resolve } from 'path';
import { config } from 'dotenv'const [arg1, _] = process.argv.slice(2) // specify environment (e.g. with first argument)
config({path: resolve(__dirname, `../${arg1}.key`)}); // load environment variablesmongoose.connect(process.env.DB_URI)
.then((m) => {
// Set Routes
const router = express.Router();
app.use("/", router);// Setup API (from @brainsatplay/accounts-node)
let users = new api.UserController(router)/* CODE TO START THE SERVER */
})
```## Notes
1. You must configure a MongoDB Realm account to accept all the authorization types you want your application to accept. This API currently supports:
- Email / Password