-
Notifications
You must be signed in to change notification settings - Fork 50
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
Cannot authenticate with token or use "installation" method #184
Comments
Hi @chopfitzroy, I tried to reproduce the problems you created. I found one bug in your code, after fixing that it all works as expected. You need to change the See my code at What is it exactly that you are trying to accomplish? The first code example is unnecessary complex, you don't need to send a manual request to create an installation access token, just use |
Hey @gr2m, The first example was just experimentation when the second example did not work. Using
Based on this I would assume I have configured something wrong, I can see the app is installed in the install app menu: and: Any ideas? Sorry for the info dump just trying to get everything that could be relevant down. |
I'm afraid I haven't seen this error before :( Does this work? const { token } = await auth({ type: "app" });
console.log(token)
const result = await githubRequest(`POST https://api.github.com/app/installations/${installationId}/access_tokens`, {
headers: {
authorization: "bearer " + token
}
}); If not, can you paste the token here and see what you get as payload? https://www.jsonwebtoken.io/ It should look like this {
"iat": 1601591683,
"exp": 1601599068,
"iss": 83211,
"jti": "814d33f1-9edf-4e00-8bd3-4843c6709629"
} If it does, can you try to reproduce the error by sending a curl request? If it doesn't, can you please contact support: support.github.com/contact, they will be able to help you further, I'm afraid I'm out of ideas on what I can do to help on the client side |
Using the above code, same error, the token is logged as follows:
Looks like it verifies correctly: Except the |
me neither, I suggest you contact support. Please keep me posted and reference this issue, I'm happy to help the great support folks in any way I can, they know how to reach me |
Hey @gr2m fantastic will move this to support, thank you so much for all your help debugging this 😁 NOTE putting here for reference, ticket logged with support: |
Hey @gr2m I figured it out, and it is really embarrassing. This line in all of my examples was the only thing I did not try swapping out for a "hard coded" string: id: process.env.API_GH_APP_ID, Well through another issue I discovered that my environment variables were not being populated, once I resolved this issue and re-tried everything went through first try! I am so sorry for taking up so much of your time! One thing I have learnt from this, is would it be worth adding some sort of |
I agree. Would you like to get a pull request going? You can start with just a failing test and we can continue the discussion there? |
Get @gr2m yes absolutely, I will try to get onto this this weekend. |
would you still like to work on it? I think |
🎉 This issue has been resolved in version 3.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
For any lost souls coming from Google, the error - name: Get token
uses: actions/github-app-token@v1
with:
app_id: Iv7.1abcdefg01234567
private_key: ${{ secrets.SHH }} And this would be right: - name: Get token
uses: actions/github-app-token@v1
with:
app_id: 42
private_key: ${{ secrets.SHH }} |
@gr2m 4 years late but after spending hours trying to make a POST request using GitHub API your first comment above finally solved my issue, thank you. |
I am trying to do an app installation and have tried two different methods and cannot seem to authenticate with either, although I do get different errors.
I have installed the app (which is in an org I have created) to my account, and using the
installation_id
that is present in the querystring of the callback URL I am trying to authenticate.The more basic/manual method I have tried is as follows:
This throws the following error:
NOTE that if I console the
token
it shows a valid string.The second method I have tried is (inspired by this question):
However this gives the following error:
NOTE if I try to console
token
here I get nothing meaning it is bailing onawait auth({ type: "installation", installationId });
I have tried to stick to the documentation samples as much as possible but I am struggling to see what to do from this point onwards.
The text was updated successfully, but these errors were encountered: