Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthGuardian support for adding express.js permissions directly #44

Open
sgrove opened this issue Jan 21, 2020 · 0 comments
Open

AuthGuardian support for adding express.js permissions directly #44

sgrove opened this issue Jan 21, 2020 · 0 comments

Comments

@sgrove
Copy link

sgrove commented Jan 21, 2020

We've been working hard on AuthGuardian to make securing every app, server, and
API as straight-forward as possible. Today we've pushed support for adding
express.js permissions for our onegraph-auth integration as a direct effect
inside AuthGuardian.

For example, if we wanted to only allow users to access the /we-rock route on
our express app if they were logged into Spotify, we could use these rules:

When this user on Spotify login status is true

Then On express js add permissions [to-rock]

and that would give us the resulting JWT:

{
  "iss": "OneGraph",
  "aud": "https://serve.onegraph.com/dashboard/app/00000000-0000-0000-0000-000000000000",
  "iat": 1579590299,
  "exp": 1579676699,
  "permissions": [
    "to-rock"
  ]
}

which we can use just like in our example expressjs + AuthGuardian app:

app.get("/we-rock", guard.check(["audiophile"]), function(req, res) {
  // Now users can only access this route...
  // with express permission to-rock!
});

Check out the source code of the example
app
if you're looking
for how to get started with Express and AuthGuardian!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant