Always return scope

This commit is contained in:
Raghunandan
2020-05-25 16:27:56 +02:00
parent 95f86e7482
commit 6cd55c3b7b
2 changed files with 17 additions and 6 deletions
@@ -92,14 +92,15 @@ export class GoogleAuthProvider
'google',
refreshToken,
params,
(err, accessToken) => {
(err, accessToken, _, params) => {
if (err || !accessToken) {
return res.status(401).send('Failed to refresh access token');
}
return res.send({
accessToken,
expiresInSeconds: 36000,
idToken: params.id_token,
expiresInSeconds: params.expires_in,
scope: params.scope,
});
},
);
@@ -121,6 +122,7 @@ export class GoogleAuthProvider
idToken: params.id_token,
accessToken,
refreshToken,
scope: params.scope,
});
},
);
+12 -3
View File
@@ -58,16 +58,25 @@ export type AuthProviderFactory = {
new (providerConfig: any): AuthProvider & AuthProviderRouteHandlers;
};
export type AuthInfo = {
profile: passport.Profile;
export type AuthInfoBase = {
accessToken: string;
idToken?: string;
expiresInSeconds?: number;
scope: string;
};
export type AuthInfoWithProfile = AuthInfoBase & {
profile: passport.Profile;
};
export type AuthInfoPrivate = AuthInfoWithProfile & {
refreshToken: string;
};
export type AuthResponse =
| {
type: 'auth-result';
payload: AuthInfo;
payload: AuthInfoBase | AuthInfoWithProfile;
}
| {
type: 'auth-result';