https://github.com/stellarfw/identify
The official authentication module for Stellar
https://github.com/stellarfw/identify
authentication module stellar
Last synced: about 2 months ago
JSON representation
The official authentication module for Stellar
- Host: GitHub
- URL: https://github.com/stellarfw/identify
- Owner: StellarFw
- Created: 2016-07-29T16:53:59.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2026-04-03T15:24:02.000Z (3 months ago)
- Last Synced: 2026-04-03T18:56:45.131Z (3 months ago)
- Topics: authentication, module, stellar
- Language: JavaScript
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Identify
Identify is an authentication solution for Stellar made to cur repetitive work involving management of users. A [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) approach on features like account creation, login, logout, confirmation by e-mail, password reset, etc.
## Composition
- actions:
- **`auth.register`** - create a new user account;
- **`auth.login`** - login with an existent user account;
- **`auth.disableUser`** - disable the user account. Disabled users can not make login;
- **`auth.checkSession`** - check the state of a token and if it's valid return the expire time (`expireAt`) and the user info (`user`);
- models:
- **`user`** - model to represent a user on the database;
- events:
- **`auth.checkSessionResponse`** - this event allows edit the response for the `auth.checkSession` action.
- middleware:
- **`auth.needAuth`** - only authenticated users can access the protected action.
## Quick start
To start using Identify on your Stellar application you can follow the commands below.
If you use git to manage the changes in your application you can add Identify as a Git submodule.
```shell
# add Identify as a Git submodule
git submodule add https://github.com/StellarFw/Identify modules/identify
```
If you don't use Git in your app you can use Git only to clone the repo or make the download of repository Zip.
```shell
git clone https://github.com/StellarFw/Identify modules/identify
```
### Activate the Module
Now to activate the module you just need add `"identify"` to the `manifest.json` file on your app root folder. Like this:
```json
{
"name": "my-awesome-app",
"version": "1.0.0",
"modules": ["identify"]
}
```
## Usage
The code below show the usage of the middleware:
```javascript
export const example = {
name: "example",
description: "This is a protected action",
middleware: ["auth.needAuth"],
run: (api, action, next) => {
// only authenticated users reach this point
// do something...
next();
},
};
```
> Note: it's recommended load this module before all the others.
## TODOs
- Add a mechanism to reset the user password
- Add a way to validate users at account creation
- Add a way to invalidate tokens