add access_type to issuer client to receive a refresh token

Signed-off-by: Hasan Ozdemir <21654050+nodify-at@users.noreply.github.com>
This commit is contained in:
Hasan Ozdemir
2021-12-02 00:41:38 +01:00
parent 36fa32216f
commit 7d50123cd5
@@ -99,7 +99,6 @@ export class OidcAuthProvider implements OAuthHandlers {
async start(req: OAuthStartRequest): Promise<RedirectInfo> {
const { strategy } = await this.implementation;
const options: Record<string, string> = {
accessType: 'offline',
scope: req.scope || this.scope || 'openid profile email',
state: encodeState(req.state),
};
@@ -143,6 +142,7 @@ export class OidcAuthProvider implements OAuthHandlers {
private async setupStrategy(options: Options): Promise<OidcImpl> {
const issuer = await Issuer.discover(options.metadataUrl);
const client = new issuer.Client({
access_type: 'offline', // this option must be passed to provider to receive a refresh token
client_id: options.clientId,
client_secret: options.clientSecret,
redirect_uris: [options.callbackUrl],