Skip to content

Commit

Permalink
docs: JWTResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed Jan 6, 2020
1 parent f25c60c commit a61fb56
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,21 @@ authentication providing service

### Table of Contents

- [JWTResponse](#jwtresponse)
- [Properties](#properties)
- [ServiceAuthenticator](#serviceauthenticator)
- [accessTokenGenerator](#accesstokengenerator)
- [Parameters](#parameters)

## JWTResponse

Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

### Properties

- `acess_token` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `token_type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** always "Bearer"

## ServiceAuthenticator

**Extends Service**
Expand All @@ -41,4 +52,4 @@ Generate a request handler to deliver JWT access tokens
- `credentials.username` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
- `credentials.password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** return jwt access_token
Returns **[JWTResponse](#jwtresponse)** jwt
8 changes: 7 additions & 1 deletion src/service-authenticator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import jwt from "jsonwebtoken";
import { mergeAttributes, createAttributes } from "model-attributes";
import { Service } from "@kronos-integration/service";

/**
* @typedef {Object} JWTResponse
* @property {string} acess_token
* @property {string} token_type always "Bearer"
*/

/**
*
*/
Expand Down Expand Up @@ -60,7 +66,7 @@ export class ServiceAuthenticator extends Service {
* @param {Object} credentials
* @param {string} credentials.username
* @param {string} credentials.password
* @return {Object} return jwt access_token
* @return {JWTResponse} jwt
*/
async accessTokenGenerator(credentials) {
try {
Expand Down

0 comments on commit a61fb56

Please sign in to comment.