An open API service indexing awesome lists of open source software.

https://github.com/replit/repl-auth-node

Nodejs client for Repl Auth functions!
https://github.com/replit/repl-auth-node

Last synced: 9 months ago
JSON representation

Nodejs client for Repl Auth functions!

Awesome Lists containing this project

README

          

# Repl Authentication
Repl Authentication is a simple way to allow users to log in, and access their information.

## Get started
Ensure that a user is logged in with replit following [our docs](https://docs.replit.com/hosting/authenticating-users-repl-auth)
```js
const express = require('express');
const { getUserInfo } = require('../index.js')

const app = express();
app.use(express.static('public'));

app.get('/', async function(req, res) {
const userInfo = getUserInfo(req)
console.log(userInfo)
}
```

## Docs

> `getUserInfo(Request req)`

Gets all user info. Returns UserInfo object.
```js
const userInfo = getUserInfo(req)
```

UserInfo object:
```
UserInfo {
id?: string;
name?: string;
bio?: string;
url?: string;
profileImage?: string;
roles?: Array
teams?: Array
}
```

## Tests
```sh
npm run test
```
Then login and assure that it says "server tests passed"