node.js - passport-oauth accessing remote url -



node.js - passport-oauth accessing remote url -

i seek implement oauth solution in nodejs. used passport-oauth generating acccess tokens , refresh tokens working.

var passport = require('passport'), oauth = require('oauth').oauth, url = require('url'), arenanet = require('passport-oauth').oauth2strategy, config = require('../config'), users = require('../../app/controllers/users.server.controller'); module.exports = function() { passport.use('arenanet', new arenanet({ authorizationurl: config.arenanet.authorizationurl, tokenurl: config.arenanet.tokenurl, clientid: config.arenanet.clientid, clientsecret: config.arenanet.clientsecret, callbackurl: config.arenanet.callbackurl, response_type: "code", scope: "offline account" }, function(accesstoken, refreshtoken, code, profile, done) { console.log(accesstoken); console.log(refreshtoken); console.log(code); done(); })); };

this generates next output:

69xxxxf-776d-4cxx-axx7-29xxxxxx4db5 5fxxxxxx-xxx67-e1xxx1-809d-xxxxxxxxxxxxxxxx-xx69-4xx6-xxf-4c6xxxxx08eb { access_token: 'xx0xxxxxf-77xxx-4xxxx-xxxa7-295xxxxxxb5', token_type: 'bearer', scope: 'account' }

i new oauth. confuses me how access remote url tokens. have in mind this:

oauth.get( "https://api.guildwars2.com/v2/account", accesstoken, function(err, body, response) { console.log(body); } );

what don't work. saw several examples how can access local sites token, not how request remote url.

any suggestion how i'm able passport-oauth? or need utilize different module action?

i hope can help me here, cool!

thank , best regards, michael

node.js oauth passport.js

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -