Skip to content

Commit

Permalink
Merge pull request #545 from curveball/return-refresh-token
Browse files Browse the repository at this point in the history
Return refresh token from access-token endpoint.
  • Loading branch information
evert authored Oct 28, 2024
2 parents a31c935 + d827e06 commit aae9fd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

0.26.4 (????-??-??)
-------------------

* New: access-token endpoint now returns refresh token.


0.26.3 (2024-10-28)
-------------------

Expand Down
7 changes: 2 additions & 5 deletions src/oauth2/controller/user-access-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import log from '../../log/service.js';
import { EventType } from '../../log/types.js';
import { PrincipalService } from '../../principal/service.js';
import * as oauth2Service from '../service.js';
import { tokenResponse } from '../formats/json.js';

class UserAccessTokenController extends Controller {

Expand All @@ -22,11 +23,7 @@ class UserAccessTokenController extends Controller {
principal: user,
});

ctx.response.body = {
access_token: token.accessToken,
token_type: token.tokenType,
expires_in: token.accessTokenExpires - Math.round(Date.now() / 1000),
};
ctx.response.body = tokenResponse(token);
log(EventType.generateAccessToken, ctx.ip()!, user.id, ctx.request.headers.get('User-Agent'));

}
Expand Down

0 comments on commit aae9fd5

Please sign in to comment.