{"action":"created","issue":{"url":"https://api.github.com/repos/lucj/sails-oauth2-api/issues/6","labels_url":"https://api.github.com/repos/lucj/sails-oauth2-api/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/lucj/sails-oauth2-api/issues/6/comments","events_url":"https://api.github.com/repos/lucj/sails-oauth2-api/issues/6/events","html_url":"https://github.com/lucj/sails-oauth2-api/issues/6","id":103330291,"number":6,"title":"Not redirected to the Allow/deny page after login","user":{"login":"lucj","id":182406,"avatar_url":"https://avatars.githubusercontent.com/u/182406?v=3","gravatar_id":"","url":"https://api.github.com/users/lucj","html_url":"https://github.com/lucj","followers_url":"https://api.github.com/users/lucj/followers","following_url":"https://api.github.com/users/lucj/following{/other_user}","gists_url":"https://api.github.com/users/lucj/gists{/gist_id}","starred_url":"https://api.github.com/users/lucj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucj/subscriptions","organizations_url":"https://api.github.com/users/lucj/orgs","repos_url":"https://api.github.com/users/lucj/repos","events_url":"https://api.github.com/users/lucj/events{/privacy}","received_events_url":"https://api.github.com/users/lucj/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-26T17:56:00Z","updated_at":"2015-09-03T11:28:24Z","closed_at":"2015-09-01T08:23:12Z","body":"I have a problem with the Authorization Code Grant that I do not manage to solve.\r\n\r\nBasically, This are the steps I follow:\r\n- run the sails app\r\n- run the unTrustedClient (node untrustedClient.js within the example folder)\r\n- from a web browser, I then issue the following URL:\r\n\r\nhttp://localhost:1337/oauth/authorize?client_id=O3UTGRFNI1&response_type=code&redirect_uri=http://localhost:1339&scope=http://localhost:1337\r\nNote: the value of the client_id is the one displayed for untrustedTestClient in the sails terminal when the application starts\r\n\r\nThis redirect me toward the 'login' page, which is fine.\r\n\r\nhttps://dl.dropboxusercontent.com/u/2330187/login.png\r\n\r\nBut when I submit the credentials (me@gmail.com /password by default) I'm redirected towards /index and not toward the original URL (the one above).\r\n\r\nhttps://dl.dropboxusercontent.com/u/2330187/index.png\r\n\r\nI need to re-issue the URL above for the dialog page (the one with the Allow / Deny options) to be displayed.\r\n\r\nhttps://dl.dropboxusercontent.com/u/2330187/allow_deny.png\r\n\r\nI'm using 'connect-ensure-login' middleware.\r\n\r\n    app.get('/oauth/authorize',\r\n        login.ensureLoggedIn(),\r\n        server.authorize(function(clientId, redirectURI, done) {\r\n            Client.findOne({clientId: clientId}, function(err, client) {\r\n                if (err) { return done(err); }\r\n                if (!client) { return done(null, false); }\r\n                if (client.redirectURI != redirectURI) { return done(null, false); }\r\n                return done(null, client, client.redirectURI);\r\n            });\r\n        }),\r\n        server.errorHandler(),\r\n        function(req, res) {\r\n            res.render('dialog', { transactionID: req.oauth2.transactionID,\r\n                             user: req.user,\r\n                             client: req.oauth2.client\r\n            });\r\n        }\r\n    ); \r\n\r\nHow can I fix this so the redirection is done automatically once I enter the credentials ?"},"comment":{"url":"https://api.github.com/repos/lucj/sails-oauth2-api/issues/comments/137412290","html_url":"https://github.com/lucj/sails-oauth2-api/issues/6#issuecomment-137412290","issue_url":"https://api.github.com/repos/lucj/sails-oauth2-api/issues/6","id":137412290,"user":{"login":"lucj","id":182406,"avatar_url":"https://avatars.githubusercontent.com/u/182406?v=3","gravatar_id":"","url":"https://api.github.com/users/lucj","html_url":"https://github.com/lucj","followers_url":"https://api.github.com/users/lucj/followers","following_url":"https://api.github.com/users/lucj/following{/other_user}","gists_url":"https://api.github.com/users/lucj/gists{/gist_id}","starred_url":"https://api.github.com/users/lucj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucj/subscriptions","organizations_url":"https://api.github.com/users/lucj/orgs","repos_url":"https://api.github.com/users/lucj/repos","events_url":"https://api.github.com/users/lucj/events{/privacy}","received_events_url":"https://api.github.com/users/lucj/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T11:28:24Z","updated_at":"2015-09-03T11:28:24Z","body":"Excellent. Thanks for your help Pawan.\n\nOn Thu, Sep 3, 2015 at 1:22 PM, Pawan Rawal <notifications@github.com>\nwrote:\n\n> Hi lucj , I got a cleaner implementation to work with routes in route.js\n> and better code organization.. Will share it with you when I cover the test\n> suite.\n> For my use case I am only implementing the Authorization Code Grant flow.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/lucj/sails-oauth2-api/issues/6#issuecomment-137411466>\n> .\n>\n\n\n\n-- \nLuc Juggery - https://about.me/lucjuggery\n"}}