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

Use of state parameter in authorisation code flow #190

Open
ciseng opened this issue Nov 10, 2016 · 6 comments
Open

Use of state parameter in authorisation code flow #190

ciseng opened this issue Nov 10, 2016 · 6 comments

Comments

@ciseng
Copy link

ciseng commented Nov 10, 2016

It seems like the state parameter is supported in the implementation, but not sure how it is used in the AS side. Could you give an example when granting code, how the server can callback also the state value?

@jaredhanson
Copy link
Owner

The state parameter is just stored and echoed back to the client. Is there something other than that you are referring to?

@ciseng
Copy link
Author

ciseng commented Nov 11, 2016

Thanks for your reply.

So, there is no change in the following code piece? If the user’s request has state, it is just echoed back? Nothing to add on the implementor’s side?

server.grant(oauth2orize.grant.code(function(client, redirectURI, user, ares, done) {
  var code = utils.uid(16);

  var ac = new AuthorizationCode(code, client.id, redirectURI, user.id, ares.scope);
  ac.save(function(err) {
    if (err) { return done(err); }
    return done(null, code);
  });
}));

@Cogiva
Copy link

Cogiva commented Jan 23, 2017

I pass in a state, but it does not appear to be echo's back to client on the final redirect. I am using angular as the front end user allow/deny page, but this is redirected after the initial authorisation call has been made, so the state should be in the session right?

@lrohrmann
Copy link

I have the same problem. Anybody knows how to handle a state URL parameter to echo back on the final redirect?

@webbcam
Copy link

webbcam commented Oct 17, 2017

Still having this problem as well (on final redirect), any solutions?

@ursualexandr
Copy link

ursualexandr commented Nov 13, 2019

Still having this problem as well, any solutions?

UPDATE:
It is working properly, you have to pass state parameter when you hit first time authorize endpoint
e.g.:
http://example.com/oauth/authorize?client_id=234523523&redirect_uri=https://example.com/signin&response_type=code&state=CfDJ8CI

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

6 participants