René's URL Explorer Experiment


Title: 401 - A JSON web token could not be decoded when following App example · Issue #19 · github-developer/github-app-template · GitHub

Open Graph Title: 401 - A JSON web token could not be decoded when following App example · Issue #19 · github-developer/github-app-template

X Title: 401 - A JSON web token could not be decoded when following App example · Issue #19 · github-developer/github-app-template

Description: Expected Behavior I am following the example of using GitHub API's in a GitHub app. This page links to another page showing how to setup the development environment to do this. I followed the instructions on that page, with one differenc...

Open Graph Description: Expected Behavior I am following the example of using GitHub API's in a GitHub app. This page links to another page showing how to setup the development environment to do this. I followed the instr...

X Description: Expected Behavior I am following the example of using GitHub API's in a GitHub app. This page links to another page showing how to setup the development environment to do this. I followed the i...

Opengraph URL: https://github.com/github-developer/github-app-template/issues/19

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"401 - A JSON web token could not be decoded when following App example","articleBody":"## Expected Behavior\r\n\r\nI am following the [example](https://docs.github.com/en/developers/apps/guides/using-the-github-api-in-your-app) of using GitHub API's in a GitHub app. This page links to [another page](https://docs.github.com/en/developers/apps/getting-started-with-apps/setting-up-your-development-environment-to-create-a-github-app) showing how to setup the development environment to do this. \r\nI followed the instructions on that page, with one difference, for testing, I kept the contents of the pem file in the code 64-encoded. The code then proceeds to decode that string to get the actual content of the pem file, and use that to construct the `PRIVATE_KEY`. So, it looks like this\r\n\r\n```\r\n  PRIVATE_KEY_ENCODED = \"some long string\"\r\n  PRIVATE_KEY_DECODED = (Base64.decode64(PRIVATE_KEY_ENCODED)).gsub('\\n', \"\\n\")\r\n  PRIVATE_KEY = OpenSSL::PKey::RSA.new(PRIVATE_KEY_DECODED)\r\n```\r\n\r\n## Actual Behavior\r\n\r\nWhen I install the GitHub app in a new organization, I the following error:\r\n`POST https://api.github.com/app/installations/27776345/access_tokens: 401 - A JSON web token could not be decoded // See: https://docs.github.com/rest (Octokit::Unauthorized)`.\r\n\r\nThis error occurs when the code tries to [get the token of a specific installation](https://github.com/github-developer/github-app-template/blob/master/template_server.rb#L117)\r\n`@installation_token = @app_client.create_app_installation_access_token(@installation_id)[:token]`\r\n\r\n## Steps to Reproduce\r\n\r\nFollow instructions in https://docs.github.com/en/developers/apps/getting-started-with-apps/setting-up-your-development-environment-to-create-a-github-app.\r\n\r\n## Context\r\n\r\nIn testing the code, in a Ruby console, I debugged the ran the template_server.rb file and placed a `binding.pry` right before [the error is thrown](https://github.com/github-developer/github-app-template/blob/master/template_server.rb#L117).\r\nI did the following:\r\n\r\n```\r\n# This is taken from https://github.com/github-developer/github-app-template/blob/master/template_server.rb#L94\r\n\r\npayload = {\r\n          # The time that this JWT was issued, _i.e._ now.\r\n          iat: Time.now.to_i,\r\n\r\n          # JWT expiration time (10 minute maximum)\r\n          exp: Time.now.to_i + (10 * 60),\r\n\r\n          # Your GitHub App's identifier number\r\n          iss: APP_IDENTIFIER\r\n      }\r\n\r\n# Calculate a jwt\r\njwt = JWT.encode(payload, PRIVATE_KEY, 'RS256')\r\n\r\n# display the installation id\r\n@installation_id\r\n```\r\n\r\nThen I ran the following cURL command in a command line.\r\n\r\ncurl -i -X POST \\\r\n-H \"Authorization: Bearer  \u003cjwt\u003e\" \\\r\n-H \"Accept: application/vnd.github+json\" \\\r\nhttps://api.github.com/app/installations/\u003c@installation_id\u003e/access_tokens\r\n\r\nI received a valid response that did include a token. So, it doesn't seem that the problem is in the code itself, but that for some reason the `Octokit::Client` is not doing the right thing in calling the intended API.\r\n\r\n","author":{"url":"https://github.com/hanysf","@type":"Person","name":"hanysf"},"datePublished":"2022-07-28T21:13:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/19/github-app-template/issues/19"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:06deef73-61f1-f1ce-ea85-83f9067a385a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE598:32A919:6F5E5:9760E:69826BC0
html-safe-nonce392528b0f772f5a1674f3f897a1b63de8c91043fbdc5d1ea1cdfd2f4fa9a1984
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTk4OjMyQTkxOTo2RjVFNTo5NzYwRTo2OTgyNkJDMCIsInZpc2l0b3JfaWQiOiI3MDYwOTY0NzA2NDE2MjI1MjE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8e01c22281cc406798dab4b950f9526eb6fddad360e92de8ad62f9f1c9dbb02e
hovercard-subject-tagissue:1321494853
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github-developer/github-app-template/19/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c1a0383be3cad7c3ebad927c6c9762c93a3cf4c2401e6dbacc6039670281be37/github-developer/github-app-template/issues/19
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c1a0383be3cad7c3ebad927c6c9762c93a3cf4c2401e6dbacc6039670281be37/github-developer/github-app-template/issues/19
og:image:altExpected Behavior I am following the example of using GitHub API's in a GitHub app. This page links to another page showing how to setup the development environment to do this. I followed the instr...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamehanysf
hostnamegithub.com
expected-hostnamegithub.com
Noned8cbbf00e6212b4e561a1d6db613194a319d58a2967494f7cc81cf6da3fbb985
turbo-cache-controlno-preview
go-importgithub.com/github-developer/github-app-template git https://github.com/github-developer/github-app-template.git
octolytics-dimension-user_id13240041
octolytics-dimension-user_logingithub-developer
octolytics-dimension-repository_id157603879
octolytics-dimension-repository_nwogithub-developer/github-app-template
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id157603879
octolytics-dimension-repository_network_root_nwogithub-developer/github-app-template
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release15d777483e72943a892af4ab5c0bbdb20215e6f3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/github-developer/github-app-template/issues/19#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub-developer%2Fgithub-app-template%2Fissues%2F19
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub-developer%2Fgithub-app-template%2Fissues%2F19
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=github-developer%2Fgithub-app-template
Reloadhttps://patch-diff.githubusercontent.com/github-developer/github-app-template/issues/19
Reloadhttps://patch-diff.githubusercontent.com/github-developer/github-app-template/issues/19
Reloadhttps://patch-diff.githubusercontent.com/github-developer/github-app-template/issues/19
github-developer https://patch-diff.githubusercontent.com/github-developer
github-app-templatehttps://patch-diff.githubusercontent.com/github-developer/github-app-template
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fgithub-developer%2Fgithub-app-template
Fork 43 https://patch-diff.githubusercontent.com/login?return_to=%2Fgithub-developer%2Fgithub-app-template
Star 30 https://patch-diff.githubusercontent.com/login?return_to=%2Fgithub-developer%2Fgithub-app-template
Code https://patch-diff.githubusercontent.com/github-developer/github-app-template
Issues 8 https://patch-diff.githubusercontent.com/github-developer/github-app-template/issues
Pull requests 4 https://patch-diff.githubusercontent.com/github-developer/github-app-template/pulls
Actions https://patch-diff.githubusercontent.com/github-developer/github-app-template/actions
Projects 0 https://patch-diff.githubusercontent.com/github-developer/github-app-template/projects
Security 0 https://patch-diff.githubusercontent.com/github-developer/github-app-template/security
Insights https://patch-diff.githubusercontent.com/github-developer/github-app-template/pulse
Code https://patch-diff.githubusercontent.com/github-developer/github-app-template
Issues https://patch-diff.githubusercontent.com/github-developer/github-app-template/issues
Pull requests https://patch-diff.githubusercontent.com/github-developer/github-app-template/pulls
Actions https://patch-diff.githubusercontent.com/github-developer/github-app-template/actions
Projects https://patch-diff.githubusercontent.com/github-developer/github-app-template/projects
Security https://patch-diff.githubusercontent.com/github-developer/github-app-template/security
Insights https://patch-diff.githubusercontent.com/github-developer/github-app-template/pulse
401 - A JSON web token could not be decoded when following App examplehttps://patch-diff.githubusercontent.com/github-developer/github-app-template/issues/19#top
https://github.com/hanysf
https://github.com/hanysf
hanysfhttps://github.com/hanysf
on Jul 28, 2022https://github.com/github-developer/github-app-template/issues/19#issue-1321494853
examplehttps://docs.github.com/en/developers/apps/guides/using-the-github-api-in-your-app
another pagehttps://docs.github.com/en/developers/apps/getting-started-with-apps/setting-up-your-development-environment-to-create-a-github-app
get the token of a specific installationhttps://github.com/github-developer/github-app-template/blob/master/template_server.rb#L117
https://docs.github.com/en/developers/apps/getting-started-with-apps/setting-up-your-development-environment-to-create-a-github-apphttps://docs.github.com/en/developers/apps/getting-started-with-apps/setting-up-your-development-environment-to-create-a-github-app
the error is thrownhttps://github.com/github-developer/github-app-template/blob/master/template_server.rb#L117
https://api.github.com/app/installations/https://api.github.com/app/installations/
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.