Permalink
Browse files

fixed applyCredentials removed port

  • Loading branch information...
1 parent 22d8c12 commit 0bbcd75c509508eeadd7a5b2f74a28d6bc9c552e @haraldrudell committed Apr 21, 2012
Showing with 16 additions and 12 deletions.
  1. +16 −11 example/example.js
  2. +0 −1 linkedin.json
View
@@ -49,25 +49,27 @@ client.authorize(function(err, url) {
}
})
-// invoked by server when our url is requested, server extects json
+// invoked by server when completeUri is requested, server expects json
// for requests to the redirect after authorizing, process and obtain Oauth access token
function completedHandler(queryObject, callback) {
// for requests to the redirect after authorizing, process and obtain Oauth access token
client.handleAuthorizing(queryObject, function(err, possibleAccessCredentials) {
// some error trying to get access tokens
if (err) callback(err, null)
+ else {
- if (possibleAccessCredentials) {
- // we just successfully obtained Oauth access tokens, save them
- // typically they last forever
- utils.writeStore(possibleAccessCredentials)
- }
+ if (possibleAccessCredentials) {
+ // we just successfully obtained Oauth access tokens, save them
+ // typically they last forever
+ utils.writeStore(possibleAccessCredentials)
+ }
- // render some final data to the user
- if (!client.hasAccess()) {
- var json = ({ issue: 'You have not authorized this application' })
- callback(null, json)
- } else doApi(callback)
+ // render some final data to the user
+ if (!client.hasAccess()) {
+ var json = ({ issue: 'You have not authorized this application' })
+ callback(null, json)
+ } else doApi(callback)
+ }
})
}
@@ -80,7 +82,10 @@ function doApi(callback) {
})
}
+// user clicked reauthenticate, browser loaded autenticateUri, and here's our handler
function authenticateHandler(callback) {
+ // clear possible authentication
client.clearAccess()
+ // re-initialize authentication, let server handle redirect to completedUri
client.authorize(callback)
}
View
@@ -1,7 +1,6 @@
{
"consumerKey": "<API Key from https://www.linkedin.com/secure/developer>",
"consumerSecret": "<Secret Key from https://www.linkedin.com/secure/developer>",
- "port": 3009,
"hostUrl": "http://localhost:3009",
"authenticateUri": "/authenticate",
"completedUri": "/",

0 comments on commit 0bbcd75

Please sign in to comment.