Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom data with authcode / token #207

Open
skippy1976 opened this issue May 18, 2017 · 1 comment
Open

Custom data with authcode / token #207

skippy1976 opened this issue May 18, 2017 · 1 comment

Comments

@skippy1976
Copy link

I have had an OAUTH server running using oath2orize for some time and use it with many different services.

I now have a need for a user to select a particular option when they perform the Allow through the Dialog. For example, when the perform allow they will select a particular option, 1, 2, 3 or 4.

I want to store this with the authcode in a seperate field as well as store it when the authcode exchange occurs.

Problem is that when I do the authsave in oauth2orize.grant.code() I do not have access to the req.query values passed in.

Any suggestions would be most appreciated.

@skippy1976
Copy link
Author

Figured it out...
In the decision code, you can pass in a value. Below you will see instanceID which I pass in when retrieved from req.body.instanceID.

exports.decision = [
login.ensureLoggedIn(),
server.decision( function(req, done) {
console.log("OAUTH: User's decision processing");
return done(null, { scope: req.body.scope, state: req.body.state, instanceID: req.body.instanceID})
})]

Then when I do the authsave, I have access to the value in ares value. I then pass this into my authsave function that writes it to the database.

server.grant(oauth2orize.grant.code(function(client, redirectURI, user, ares, done) {
console.log("OUATH: Going to perform grant");
var code = utils.uid(48);

db.authsave(code, client.id, redirectURI, user.id, ares.instanceID, function(err) {
	if (err) {
		return done(err); 
	}
	
	done(null, code);
});

}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant