From e52d0026b9d4683177f4b596af6c614237867ee5 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Tue, 23 Apr 2024 11:38:46 +0200 Subject: [PATCH 1/2] Make client_secret optional since it's not always required Apps using the device flow does not have a client secret and can generate new access tokens using the refresh_token grant without this parameter in the request. Example request: ```python requests.post( "https://github.com/login/oauth/access_token", data={ "client_id": "", "refresh_token": refresh_token, "grant_type": "refresh_token", }, ) ``` --- .../refreshing-user-access-tokens.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens.md b/content/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens.md index 345d5ec8cabc..185ce0f2a5cd 100644 --- a/content/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens.md +++ b/content/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens.md @@ -50,7 +50,7 @@ If you opt into user access tokens that expire after you have already generated Query parameter | Type | Description -----|------|------------ `client_id` | `string` | **Required.** The client ID for your {% data variables.product.prodname_github_app %}. The client ID is different from the app ID. You can find the client ID on the settings page for your app. - `client_secret` | `string` | **Required.** The client secret for your {% data variables.product.prodname_github_app %}. You can generate a client secret on the settings page for your app. + `client_secret` | `string` | **Optional.** The client secret for your {% data variables.product.prodname_github_app %}. You can generate a client secret on the settings page for your app. Omit this when the user access token was generated using the device flow. `grant_type` | `string` | **Required.** The value must be "refresh_token". `refresh_token` | `string` | **Required.** The refresh token that you received when you generated a user access token. From 5bcd5bad7b0d26f10b226e7cfe07787efcec9649 Mon Sep 17 00:00:00 2001 From: Sarah Edwards Date: Tue, 23 Apr 2024 13:14:09 -0700 Subject: [PATCH 2/2] Apply suggestions from code review --- .../refreshing-user-access-tokens.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens.md b/content/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens.md index 185ce0f2a5cd..877136f9fee4 100644 --- a/content/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens.md +++ b/content/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens.md @@ -50,7 +50,7 @@ If you opt into user access tokens that expire after you have already generated Query parameter | Type | Description -----|------|------------ `client_id` | `string` | **Required.** The client ID for your {% data variables.product.prodname_github_app %}. The client ID is different from the app ID. You can find the client ID on the settings page for your app. - `client_secret` | `string` | **Optional.** The client secret for your {% data variables.product.prodname_github_app %}. You can generate a client secret on the settings page for your app. Omit this when the user access token was generated using the device flow. + `client_secret` | `string` | **Required** unless the user access token was generated using the device flow. The client secret for your {% data variables.product.prodname_github_app %}. `grant_type` | `string` | **Required.** The value must be "refresh_token". `refresh_token` | `string` | **Required.** The refresh token that you received when you generated a user access token.