Skip to content

Commit

Permalink
fix: add token_type
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed Dec 28, 2019
1 parent 44bf1bf commit 01c17b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/service-authenticator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export class ServiceAuthenticator extends Service {
);
}

static get description() { return "provide authentication services"; }
static get description() {
return "provide authentication services";
}

static get endpoints() {
return {
Expand Down Expand Up @@ -77,6 +79,7 @@ export class ServiceAuthenticator extends Service {

if (entitlements.length > 0) {
return {
token_type: "Bearer",
access_token: jwt.sign(
{ entitlements: entitlements.join(",") },
this.jwt.private,
Expand All @@ -93,4 +96,4 @@ export class ServiceAuthenticator extends Service {
}
}

export default ServiceAuthenticator;
export default ServiceAuthenticator;
4 changes: 2 additions & 2 deletions tests/auth-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const config = {

test("service-auth", async t => {
const sp = new StandaloneServiceProvider();
const {auth} = await sp.declareServices(config);
const { auth } = await sp.declareServices(config);
await auth.start();

t.is(auth.description, "provide authentication services");
Expand All @@ -41,7 +41,7 @@ test("service-auth", async t => {
password: "test"
});

// t.is(response.username, 'user1');
t.is(response.token_type, "Bearer");
const access_token = response.access_token;
const data = JSON.parse(Buffer.from(access_token.split(".")[1], "base64"));

Expand Down

0 comments on commit 01c17b2

Please sign in to comment.