This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.badge{ | |
width : fit-content; | |
padding: 4px; | |
border-radius: 30px; | |
} | |
.badge-success { | |
background: green; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
//.... | |
"paths": { | |
"@auth/*": [ | |
"my_path/auth/*" | |
], | |
"@shared/*": [ | |
"shared/*" | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Nest authentication By Digikare</title> | |
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.1/socket.io.slim.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class AuthModule implements NestModule { | |
public configure(consumer: MiddlewaresConsumer) { | |
consumer | |
// Saving the socketId on session | |
.apply(SessionAuthMiddleware).forRoutes('/auth/google') | |
// Authenticate to google signin api for /auth/google route | |
.apply(StrategyMiddleware).with({ provider: 'google' }).forRoutes('/auth/google') | |
// After signin google call this endpoint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, NestMiddleware } from '@nestjs/common'; | |
import { ExpressMiddleware } from '@nestjs/common/interfaces/middlewares/express-midleware.interface'; | |
import { NextFunction } from 'express'; | |
@Injectable() | |
export class SessionAuthMiddleware implements NestMiddleware { | |
constructor() { | |
} | |
async resolve(...args: any[]): Promise<ExpressMiddleware> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@nestjs/common'; | |
import { OAuth2Strategy } from 'passport-google-oauth'; | |
import * as passport from 'passport'; | |
@Injectable() | |
export class GoogleStrategy extends OAuth2Strategy { | |
constructor() { | |
// http://www.passportjs.org/docs/google/ | |
super({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller() | |
export class AuthController { | |
// The endpoint called from google after signin | |
@Get('google/callback') | |
public async googleCallback() { | |
} | |
@Get('google') | |
public async googleSignIn() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "1.0.0", | |
"icons": [ | |
"fa-500px", | |
"fa-accessible-icon", | |
"fa-accusoft", | |
"fa-address-book", | |
"fa-address-card", | |
"fa-adjust", | |
"fa-adn", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Karma configuration file, see link for more information | |
// https://karma-runner.github.io/0.13/config/configuration-file.html | |
process.env.CHROME_BIN = require('puppeteer').executablePath(); | |
module.exports = function (config) { | |
config.set({ | |
basePath: '', | |
frameworks: ['jasmine', '@angular/cli'], | |
plugins: [ | |
require('karma-jasmine'), |