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

The example hangs on [ EXECUTING: Generate Authorization Code] #13

Closed
Zireael opened this issue May 15, 2020 · 4 comments
Closed

The example hangs on [ EXECUTING: Generate Authorization Code] #13

Zireael opened this issue May 15, 2020 · 4 comments

Comments

@Zireael
Copy link

Zireael commented May 15, 2020

When I run the example and get to
http://localhost:3030/oauth/?grant_type=authorization_code&response_type=code&client_id=myClientId&redirect_uri=http://localhost:3030/client/app&state=myState
and submit with defailt username and password, the page hangs forever. There are no errors in the console. Possibly some .next() missing?

@rrahulraja
Copy link

If you comment the code block of generateAuthorizationCode() function and run the example, it works.
I have tried that and its working. When you comment it the library checks if user has passed the above function or not, if not then it will execute its internal code block for generating authorization code and return that one.

@pthartmann
Copy link

Commenting out generateAuthorizationCode() worked for me too.
@14gasher, any chance you would be able to update this?

I am comparing these two examples that have a postgres DB implemented.
https://github.com/diogosouza/logrocket-oauth2-example
https://github.com/oauthjs/express-oauth-server/tree/master/examples/postgresql

Perhaps your Express-Shield would be a good candidate to add a Postgres backend?

Really appreciate the html example you have so far, thank you.

@manh-vv
Copy link

manh-vv commented Aug 12, 2020

@14gasher had already found a way to fix this:

.

    /* 
    For this to work, you are going have to hack this a little bit:
    1. navigate to the node_modules folder
    2. find the oauth_server folder. (node_modules/express-oauth-server/node_modules/oauth2-server)
    3. open lib/handlers/authorize-handler.js
    4. Make the following change (around line 136):

    AuthorizeHandler.prototype.generateAuthorizationCode = function (client, user, scope) {
      if (this.model.generateAuthorizationCode) {
        // Replace this
        //return promisify(this.model.generateAuthorizationCode).call(this.model, client, user, scope);
        // With this
        return this.model.generateAuthorizationCode(client, user, scope)
      }
      return tokenUtil.generateRandomToken();
    };
    */

@14gasher
Copy link
Owner

As pointed out, this is a problem in the library. I've pointed it out several times to the community over there, but they still haven't fixed it.

This was referenced Nov 8, 2021
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

5 participants