voting-app icon indicating copy to clipboard operation
voting-app copied to clipboard

Auth via GitHub failed

Open fishmandev opened this issue 3 years ago • 11 comments

Request URL: https://oswils44oj.execute-api.us-east-1.amazonaws.com/production//login Status Code: 500 Internal Server Error Response:

{
    "errorMessage": "[500] Github API user data request failed: {\"message\":\"Must specify access token via Authorization header. https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param\",\"documentation_url\":\"https://docs.github.com/v3/#oauth2-token-sent-in-a-header\"}",
    "errorType": "Error",
    "stackTrace": [
        "/var/task/handlers/login.js:43:28",
        "config.sendError (/var/task/node_modules/github/lib/index.js:798:13)",
        "/var/task/node_modules/github/lib/index.js:805:29",
        "callCallback (/var/task/node_modules/github/lib/index.js:680:17)",
        "IncomingMessage.<anonymous> (/var/task/node_modules/github/lib/index.js:736:25)",
        "emitNone (events.js:72:20)",
        "IncomingMessage.emit (events.js:166:7)",
        "endReadableNT (_stream_readable.js:905:12)",
        "nextTickCallbackWith2Args (node.js:437:9)",
        "process._tickDomainCallback (node.js:392:17)"
    ]
}

fishmandev avatar Oct 06 '21 07:10 fishmandev

/cc @snitin315 @EugeneHlushko maybe you can look at this?

alexander-akait avatar Oct 06 '21 09:10 alexander-akait

I can look into it, but it will take some time as I am not familiar with this repo and the GitHub API.

snitin315 avatar Oct 06 '21 11:10 snitin315

@alexander-akait, is there a source code for the backend (oswils44oj.execute-api.us-east-1.amazonaws.com/production) on GitHub?

fishmandev avatar Oct 07 '21 07:10 fishmandev

Here the place https://github.com/webpack/voting-app/blob/master/src/utils/js/api.js wher we should change format

alexander-akait avatar Oct 07 '21 12:10 alexander-akait

https://github.com/webpack/voting-app/blob/master/src/utils/js/api.js#L20

alexander-akait avatar Oct 07 '21 12:10 alexander-akait

Here the place https://github.com/webpack/voting-app/blob/master/src/utils/js/api.js wher we should change format

@alexander-akait , why do we need to change the format in this request? It seems to me that everything is alright in this one, let's take a look 2

As you can see, the request was successful and returned with a 302 code:

https://github.com/login/oauth/authorize?client_id=4d355e2799cb8926c665&scope=user:email&state=0.42817076763951745&allow_signup=false&redirect_uri=https%3A%2F%2Fwebpack.js.org%2Fvote%2F

And from the second line: https://webpack.js.org/vote/?code=8a9d69105a034ac2a5cc&state=0.42817076763951745 GitHub has successfully called a callback with the appropriate parameters. It remains only to exchange the code for a token.

https://github.com/webpack/voting-app/blob/f921a39c1ed64c88f32576376686213c43855665/src/utils/js/api.js#L54 Sending a request to the backend server...

1

And instead of a token, we get a stack trace of errors

fishmandev avatar Oct 07 '21 15:10 fishmandev

hm, our backed is broken...

alexander-akait avatar Oct 07 '21 15:10 alexander-akait

Is there its source code on github?

fishmandev avatar Oct 07 '21 15:10 fishmandev

@skipjack maybe you know?

alexander-akait avatar Oct 07 '21 15:10 alexander-akait

Oof, it’s been a while since I did the initial prototype. I believe @sokra put that backend together and I can’t recall whether it was pushed anywhere. Maybe not for security reasons, not sure. @sokra do you remember?

skipjack avatar Oct 07 '21 16:10 skipjack