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

automate

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

automate

Automatic Link API Client

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Automatic API Wrapper

See Automatic API for more details.

Installation

npm install automate --save

Usage

express = require 'express'
cookieParser = require 'cookie-parser'
{AutomaticAPIClient} = require 'automate'

automaticAccessToken = 'automaticAccessToken'
api = new AutomaticAPIClient
  appId: '1234567890'     # replace with your app id
  appSecret: '1234567890' # replace with your app secred

app = express()

app.use cookieParser()

app.get '/', (req, res) ->
  accessToken = req.cookies[automaticAccessToken]
  res.redirect api.getAuthorizeUrl() unless accessToken

  # optionally define request parameters
  qs =
    page: req.query.page or 1
    max_per_page: 100

  api.setAccessToken accessToken
  api.getTrips {qs}, (err, response) ->
    res.end response.body

app.get '/redirect', (req, res) ->
  {state, code} = req.query
  api.accessGranted {state, code}, (err, token) ->
    return err if err?
    res.cookie automaticAccessToken, JSON.stringify(token), maxAge: new Date(token.expiresAt) - new Date()
    res.redirect '/'

app.listen 3070

FAQs

Package last updated on 14 Jul 2014

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

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