Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

passport-google-oauth-token

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-google-oauth-token - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

lib/index.cjs

24

package.json
{
"name": "passport-google-oauth-token",
"version": "1.0.5",
"version": "1.0.6",
"description": "Google access token authentication strategy for Passport",

@@ -22,4 +22,12 @@ "author": "Alpha",

},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "./lib/index.cjs",
"module": "./lib/index.mjs",
"types": "./lib/index.d.ts",
"exports": {
".": {
"import": "./lib/index.mjs",
"require": "./lib/index.cjs",
"types": "./lib/index.d.ts"
}
},
"dependencies": {

@@ -30,14 +38,12 @@ "passport-oauth2": "^1.7.0"

"@types/express": "^4.17.17",
"@types/jest": "^29.4.0",
"@types/oauth": "^0.9.1",
"@types/passport-oauth2": "^1.4.12",
"jest": "^29.5.0",
"oauth": "^0.10.0",
"ts-jest": "^29.0.5"
"vitest": "^0.29.8"
},
"scripts": {
"prepublish": "rm -rf lib && tsc",
"test": "jest --config jest.config.json",
"update-packages": "pnpm update -i -r --latest"
"prepublish": "pnpm build",
"build": "rollup --config rollup.config.ts --configPlugin typescript",
"test": "vitest run --passWithNoTests"
}
}

@@ -0,1 +1,3 @@

import { describe, it, expect, vi } from 'vitest';
import userinfo from './fixtures/userinfo.json';

@@ -138,14 +140,14 @@ import GoogleOauthTokenStrategy from '../Strategy';

describe('GoogleOauthTokenStrategy#userProfile', () => {
it('should properly fetch profile', (done) => {
it('should properly fetch profile', ({ onTestFailed }) => {
const strategy = initStrategy();
jest
.spyOn(strategy.oauth2Instance, 'get')
.mockImplementation((_url, _accessToken, next) => {
vi.spyOn(strategy.oauth2Instance, 'get').mockImplementation(
(_url, _accessToken, next) => {
next(null as any, userinfo as any, null as any);
});
},
);
strategy.userProfile(defaultAccessToken, (error, profile) => {
if (error) {
return done(error);
return onTestFailed(error);
}

@@ -163,16 +165,14 @@

jest.clearAllMocks();
done();
vi.clearAllMocks();
});
});
it('should properly handle exception on fetching profile', (done) => {
it('should properly handle exception on fetching profile', () => {
const strategy = initStrategy();
jest
.spyOn(strategy.oauth2Instance, 'get')
.mockImplementation((_url, _accessToken, next) => {
vi.spyOn(strategy.oauth2Instance, 'get').mockImplementation(
(_url, _accessToken, next) => {
next(null as any, 'not a JSON');
});
},
);

@@ -183,14 +183,11 @@ strategy.userProfile(defaultAccessToken, (error, profile) => {

jest.clearAllMocks();
done();
vi.clearAllMocks();
});
});
it('should properly throw error on _oauth2.get error', (done) => {
it('should properly throw error on _oauth2.get error', () => {
const strategy = initStrategy();
jest
.spyOn(strategy.oauth2Instance, 'get')
.mockImplementation((_url, _accessToken, next) => {
vi.spyOn(strategy.oauth2Instance, 'get').mockImplementation(
(_url, _accessToken, next) => {
next({

@@ -200,3 +197,4 @@ statusCode: 401,

});
});
},
);

@@ -206,7 +204,5 @@ strategy.userProfile(defaultAccessToken, (error, _profile) => {

jest.clearAllMocks();
done();
vi.clearAllMocks();
});
});
});
/* eslint-disable @typescript-eslint/naming-convention */
import OAuth2Strategy from 'passport-oauth2';
import { InternalOAuthError } from 'passport-oauth2';
import {
InternalOAuthError,
type VerifyFunctionWithRequest as POVerifyFunctionWithRequest,
} from 'passport-oauth2';
import type { OAuth2 } from 'oauth';
import type { Request } from 'express';
import type { VerifyFunctionWithRequest as POVerifyFunctionWithRequest } from 'passport-oauth2';

@@ -10,0 +12,0 @@ import type {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc