Passport-Mock-GoogleOAuth2
Passport-Mock-GoogleOAuth2 is a mock library to mocking Google OAuth2 authentication for Node.js.
Install
$ npm install passport-mock-googleoauth2
Usage
Load this mock lib in your app.js file like other strategies.
var express = ;var passport = ;var session = ;var app = ;var MockStrategy = ; app; var options = id: 1 displayName: "Test DisplayName" familyName: "Test FamilyName" givenName: "Test GivenName" passAuthentication: true;var { ;} passport
Write router like below.
var express = ;var router = express;var passport = ; const isAuthenticated = { ifreq ; else res; }router; router; router; router; moduleexports = router;
After accessing to '/auth/google'
, you can correctly access to '/secure'
.
Examples
Examples are included in /examples
dir.
Related Modules
Tests
$ npm install$ npm test
Credits
License
Copyright(c) 2018 Osamtimizer