Socket
Book a DemoInstallSign in
Socket

express-admob-ssv

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-admob-ssv

ExpressJS middleware & library to verify Google AdMob Server-Side Verification request

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

express-admob-ssv npm version

ExpressJS middleware to provide verification Google AdMob Server-Side request for rewarded ads.

Usage Examples:

const express = require('express');
const app = express();

const AdMobSSV = require('express-admob-ssv');

app.get('/admob/rewards/verify',
  AdMobSSV.middleware(),
  (req, res, next) => {
    // SSV Valid
    // here goes Your logic
  });

const PORT = process.env.PORT || 8080
app.listen(PORT, () => console.log(`app listening at: ${PORT}`));

using verify method in Your custom middleware:

const {URL} = require('url');
const express = require('express');
const app = express();

const {methods: {verify: verifyAdMobSSV}} = require('express-admob-ssv');

app.get('/admob/rewards/verify',
  async (req, res, next) => {
    try {
      const url = new URL(req.protocol + '://' + req.get('host') + req.originalUrl);
      await verifyAdMobSSV(url, true); // true for throwing errors
    }
    catch(error) {
      // Do something
      // or log somethings
      return res.status(400).end(error.message);
    }
    next();
  },
  (req, res, next) => {
    // SSV Valid
    // here goes Your logic
  });

const PORT = process.env.PORT || 8080
app.listen(PORT, () => console.log(`app listening at: ${PORT}`));

Keywords

express

FAQs

Package last updated on 14 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts