No description
Find a file
2020-05-16 18:53:43 +01:00
example improve auth 2020-05-14 02:47:49 +01:00
.eslintrc.yml initial commit 2020-05-13 23:45:34 +01:00
.gitignore initial commit 2020-05-13 23:45:34 +01:00
index.js add extra catching 2020-05-16 18:53:43 +01:00
package-lock.json initial commit 2020-05-13 23:45:34 +01:00
package.json add extra catching 2020-05-16 18:53:43 +01:00
README.md update readme 2020-05-14 03:12:51 +01:00

express-pleroma-authenticator

Implement pleroma-linked oauth2 on your express thing!

Usage:

PleromaAuth(baseUrl, opts);

const auth = new PleromaAuth(
    'https://myfediverse.instance',
    { redirectUris: `http://localhost:${port}/callback` } 
);

await auth.login(req, res);
const { access_token } = await auth.oauthCallback(code);
const whoAmI = await auth.checkCredentials(access_token);

Options:

  • clientName
  • redirectUris
  • scopes

Essentially .login(req, res) will redirect your user to the oauth page, then once they log in they'll be thrown back to your redirect URI with something in the code GET param. You need to handle that request and fire off oauthCallback to get your actual access token. Then from there you can do whatever.

See example/ for full usage.