This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using require rather than import to make this simple for a standard javascript example | |
const {connect, StringCodec, credsAuthenticator} = require('nats'); | |
const {encodeAccount, encodeUser} = require('nats-jwt'); | |
const {createAccount, createUser, fromSeed} = require('nkeys.js'); | |
// The Seed representing the Operator - you'll need this to sign new Accounts. Notice it starts with 'SO' | |
const opSeed = 'SOA...'; | |
// The JWT representing the User from the System Account (Step 4) | |
const sysJwt = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJlZDI1NTE5LW5rZXkifQ...'; | |
// The Seed representing the User from the System Account (Step 3). Notice it starts with 'SU' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jwt from 'jsonwebtoken'; | |
import qs from 'querystring'; | |
import jkwsClient from 'jwks-rsa'; | |
import axios from 'axios'; | |
import Boom from '@hapi/boom'; | |
import passport from "passport"; | |
import {Strategy as BearerStrategy} from "passport-http-bearer"; | |
// CORE is the domain + authGroup of the Core EOS OIDC connection (aka issuer) | |
const CORE = process.env.CORE_EOS; |