-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Unable to Parse Private Key #3227
Comments
@bradleyfalzon - can you please comment? |
Is there a native way to handle the auth without either of the other packages? I just need something to get me by for now and I would rather not have to read from a file for this value if I can help it. |
Did you take a look at this basic auth example? |
Does that work for GitHub app auth? |
Sorry, I don't know. We'll need someone who has worked with GitHub app auth to respond. |
Both implementations seem to call refs: |
I can take a look in https://github.com/jferrl/go-githubauth just to try to fix it. |
Im trying to reproduce the issue with go-githubauth package main
import (
"fmt"
"github.com/jferrl/go-githubauth"
)
const key = `-----BEGIN RSA PRIVATE KEY-----
KEY GOES HERE
-----END RSA PRIVATE KEY-----`
func main() {
_, err := githubauth.NewApplicationTokenSource(123456, []byte(key))
if err != nil {
fmt.Println("Error creating application token source:", err)
return
}
} and seems to be ok. @coleglencairn |
Hi, I am trying to use the ghinstallation
ghinstallation.New()
method, as referenced in the docs, to create a transport for use in my github client, but I am having trouble with my RSA key being parsed. When I usedghinstallation.NewKeyFromFile()
everything worked fine, but swapping toNew()
and feeding in a string of the key as a byte gives me the following error:could not parse private key: Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key
. I am confused by this because in their transport_test.go they are doing it the exact same way and I have to assume the tests are passing. I tried usinggo-githubauth
as well, but ran into the same issue so it seems like the problem may exist somewhere in here for reading the key value in this way. Am I missing something?New()
: https://github.com/bradleyfalzon/ghinstallation/blob/d680810648e94347929da00376d1e7067f3572dd/transport_test.go#L167My code is like this:
The text was updated successfully, but these errors were encountered: