-
I am building a Next JS app that has Github Login through Auth0 and uses the Octokit to fetch user info / repos. In order to get the IDP I had to setup a management api in auth0. https://community.auth0.com/t/can-i-get-the-github-access-token/47237 which I have setup in my NodeJs server to hide the management api token as : GET /getaccesstoken endpoint On the client side : /chooserepo page, I have the following code :
And
However, I keep getting Bad credentials error. If I directly put the access token in the Octokit it seems to work well, but doesn't work when it's fetching the access token from the server. It seems like Octokit instance is created before server side props are sent. Would love to get some advice on the fix. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I figured out the error by comparing the difference between the request headers when hardcoding and fetching access token from server. Turns out quotes and backslashes need to be replaced (and aren't visible when just console logging) |
Beta Was this translation helpful? Give feedback.
I figured out the error by comparing the difference between the request headers when hardcoding and fetching access token from server. Turns out quotes and backslashes need to be replaced (and aren't visible when just console logging)