fix refresh data carrying
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Timo Hocker 2022-08-03 16:21:00 +02:00
parent 84be087743
commit 122bd7b574
Signed by: Timo
GPG Key ID: AA43099EDEEB12AC
3 changed files with 10 additions and 4 deletions

View File

@ -139,7 +139,7 @@ class GatewayClass {
const con = req.connection as unknown as Record<string, unknown>;
con.auth = {
token_id: refresh_result.access_token_id,
token_data: this._options.refresh_settings.data
token_data: ver.data
};
logger ('tokens refreshed');

View File

@ -1,6 +1,6 @@
{
"name": "@sapphirecode/auth-server-helper",
"version": "3.2.0",
"version": "3.2.1",
"main": "dist/index.js",
"author": {
"name": "Timo Hocker",

View File

@ -81,8 +81,12 @@ describe ('gateway', () => {
});
it ('should automatically return new tokens', async () => {
const token = await authority.sign ('access_token', 60);
const refresh = await authority.sign ('refresh_token', 3600);
const token = await authority.sign ('access_token', 60, { data: 'foobar' });
const refresh = await authority.sign (
'refresh_token',
3600,
{ data: 'foobar' }
);
jasmine.clock ()
.tick (70000);
const resp = await get (
@ -94,6 +98,8 @@ describe ('gateway', () => {
expect (JSON.parse (resp.body as string).token_id)
.not
.toEqual (token.id);
expect (JSON.parse (resp.body as string).token_data)
.toEqual ('foobar');
});
it ('should correctly deliver token data', async () => {