{"action":"opened","issue":{"url":"https://api.github.com/repos/jaredhanson/oauth2orize/issues/141","labels_url":"https://api.github.com/repos/jaredhanson/oauth2orize/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/jaredhanson/oauth2orize/issues/141/comments","events_url":"https://api.github.com/repos/jaredhanson/oauth2orize/issues/141/events","html_url":"https://github.com/jaredhanson/oauth2orize/issues/141","id":111456537,"number":141,"title":"Req.user is sometimes a user and sometimes a client","user":{"login":"facultymatt","id":1406258,"avatar_url":"https://avatars.githubusercontent.com/u/1406258?v=3","gravatar_id":"","url":"https://api.github.com/users/facultymatt","html_url":"https://github.com/facultymatt","followers_url":"https://api.github.com/users/facultymatt/followers","following_url":"https://api.github.com/users/facultymatt/following{/other_user}","gists_url":"https://api.github.com/users/facultymatt/gists{/gist_id}","starred_url":"https://api.github.com/users/facultymatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facultymatt/subscriptions","organizations_url":"https://api.github.com/users/facultymatt/orgs","repos_url":"https://api.github.com/users/facultymatt/repos","events_url":"https://api.github.com/users/facultymatt/events{/privacy}","received_events_url":"https://api.github.com/users/facultymatt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-14T18:06:14Z","updated_at":"2015-10-14T18:06:14Z","closed_at":null,"body":"It's confusing that req.user is a client when doing a client credentials exchange. This makes for some messy checking when we want to determine if we are working with a user model or client model.\r\n\r\nAn easy workaround that I have used is to make req.user always be a user, and put the client into req.authInfo.client. This ensures consistent access across the app. \r\n\r\nHowever it creates an issue where you can't validate a client credentials exchange, because req.user is always passed into the exchange function. See https://github.com/jaredhanson/oauth2orize/blob/master/lib/exchange/clientCredentials.js#L36\r\n\r\n\r\n"}}