{"action":"closed","issue":{"url":"https://api.github.com/repos/jsforce/jsforce/issues/824","repository_url":"https://api.github.com/repos/jsforce/jsforce","labels_url":"https://api.github.com/repos/jsforce/jsforce/issues/824/labels{/name}","comments_url":"https://api.github.com/repos/jsforce/jsforce/issues/824/comments","events_url":"https://api.github.com/repos/jsforce/jsforce/issues/824/events","html_url":"https://github.com/jsforce/jsforce/issues/824","id":368436355,"node_id":"MDU6SXNzdWUzNjg0MzYzNTU=","number":824,"title":"Confusion on refresh token flow","user":{"login":"kylesimmonds","id":6350880,"node_id":"MDQ6VXNlcjYzNTA4ODA=","avatar_url":"https://avatars2.githubusercontent.com/u/6350880?v=4","gravatar_id":"","url":"https://api.github.com/users/kylesimmonds","html_url":"https://github.com/kylesimmonds","followers_url":"https://api.github.com/users/kylesimmonds/followers","following_url":"https://api.github.com/users/kylesimmonds/following{/other_user}","gists_url":"https://api.github.com/users/kylesimmonds/gists{/gist_id}","starred_url":"https://api.github.com/users/kylesimmonds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kylesimmonds/subscriptions","organizations_url":"https://api.github.com/users/kylesimmonds/orgs","repos_url":"https://api.github.com/users/kylesimmonds/repos","events_url":"https://api.github.com/users/kylesimmonds/events{/privacy}","received_events_url":"https://api.github.com/users/kylesimmonds/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-10-09T23:24:07Z","updated_at":"2018-10-11T15:32:53Z","closed_at":"2018-10-11T15:32:53Z","author_association":"NONE","body":"\r\nI'm looking at this code in the jsforce docs about the access/refresh token flow:\r\n\r\n```\r\nvar conn = new jsforce.Connection({\r\n  oauth2 : {\r\n    clientId : '<your Salesforce OAuth2 client ID is here>',\r\n    clientSecret : '<your Salesforce OAuth2 client secret is here>',\r\n    redirectUri : '<your Salesforce OAuth2 redirect URI is here>'\r\n  },\r\n  instanceUrl : '<your Salesforce server URL (e.g. https://na1.salesforce.com) is here>',\r\n  accessToken : '<your Salesforrce OAuth2 access token is here>',\r\n  refreshToken : '<your Salesforce OAuth2 refresh token is here>'\r\n});\r\n\r\nconn.on(\"refresh\", function(accessToken, res) {\r\n  // Refresh event will be fired when renewed access token\r\n  // to store it in your storage for next request\r\n});\r\n```\r\n\r\nDoes jsforce automatically catch expired access tokens and refresh them? Or does my connection need some extra catch when it makes a `query()`? Should I manually call `conn.refreshToken()` every time I make a connection?\r\n\r\nThe reason I ask is because I periodically receive errors from jsforce about expired access tokens and invalid grants. With the code above, are those just notifications to be aware of, or are they actual errors caused by users being unable to refresh their access tokens? jsforce doesn't make it clear when it's actually validating and refreshing tokens.\r\n\r\nSorry if that's a little vague, I'm still trying to wrap my head around how this needs to be structured within express and my client-side app"}}
{"actor":{"display_login":"kylesimmonds"}}