Skip to content

GaneshSinghPapola/node-pinit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

node-pinit

This module is used to authenticate a pinterest account and simply fetch user's details and an access-token from pinterest account. Before using this module you must register an app in your Pinterest developer account.

Installation

npm i --save node-pinit

Usage

In nodejs file

var Pinterest  = require('node-pinit');

var options = {
  redirect_uri: 'your redirection url given by pinterest',
  client_id: 'your app id given by pinterest', 
  client_secret: 'your app secret given by pinterest',
  scope: "read_public,write_public,read_relationships,write_relationships", //given in pinterest docs
  state: 'randombytes', // a random string
  fields:'id,first_name,last_name,image,url' //fields for profile info
};

var pinterest = new Pinterest(options);

app.get('/pins', pinterest.authorization); //route to open pinterest login

app.get('/auth/pins/callback', function (req, res, next) { //this route should match with your redirect_uri in options
  pinterest.profile(req, function (error, data) {
    // your profile data with access token
    console.log(data);
    res.send(data);
  })
})

About

To use pinterest api's in javascript, we need an access-token. This repository is for to get user information and access-token

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors