Skip to content

Commit 4780a16

Browse files
lucascostiHeather Harvey
andauthored
Multi callback URLs future functionality: using URL parameters or manifests (#16233)
Co-authored-by: Heather Harvey <hmharvey@github.com>
1 parent 9b06573 commit 4780a16

2 files changed

Lines changed: 27 additions & 11 deletions

File tree

content/developers/apps/creating-a-github-app-from-a-manifest.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ The person creating the app will be redirected to a GitHub page with an input fi
5959
`name` | `string` | The name of the GitHub App.
6060
`url` | `string` | **Required.** The homepage of your GitHub App.
6161
`hook_attributes` | `object` | The configuration of the GitHub App's webhook.
62-
`redirect_url` | `string` | The full URL to redirect to after the person installs the GitHub App.
62+
`redirect_url` | `string` | The full URL to redirect to after a user initiates the creation of a GitHub App from a manifest.{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@next" or currentVersion ver_gt "enterprise-server@3.0" %}
63+
`callback_urls` | `array of strings` | A full URL to redirect to after someone authorizes an installation. You can provide up to 10 callback URLs.{% else %}
64+
`callback_url` | `string` | A full URL to redirect to after someone authorizes an installation.{% endif %}
6365
`description` | `string` | A description of the GitHub App.
6466
`public` | `boolean` | Set to `true` when your GitHub App is available to the public or `false` when it is only accessible to the owner of the app.
6567
`default_events` | `array` | The list of [events](/webhooks/event-payloads) the GitHub App subscribes to.
@@ -96,7 +98,10 @@ This example uses a form on a web page with a button that triggers the `POST` re
9698
"hook_attributes": {
9799
"url": "https://example.com/github/events",
98100
},
99-
"redirect_url": "https://example.com/callback",
101+
"redirect_url": "https://example.com/redirect",
102+
{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@next" or currentVersion ver_gt "enterprise-server@3.0" %}"callback_urls": [
103+
"https://example.com/callback"
104+
],{% else %}"callback_url": "https://example.com/callback",{% endif %}
100105
"public": true,
101106
"default_permissions": {
102107
"issues": "write",
@@ -111,10 +116,11 @@ This example uses a form on a web page with a button that triggers the `POST` re
111116
})
112117
</script>
113118
```
119+
114120
This example uses a form on a web page with a button that triggers the `POST` request for an organization account. Replace `ORGANIZATION` with the name of the organization account where you want to create the app.
115121

116122
```html
117-
<form action="https://github.com/organizations/<em>ORGANIZATION</em>/settings/apps/new?state=abc123" method="post">
123+
<form action="https://github.com/organizations/ORGANIZATION/settings/apps/new?state=abc123" method="post">
118124
Create a GitHub App Manifest: <input type="text" name="manifest" id="manifest"><br>
119125
<input type="submit" value="Submit">
120126
</form>
@@ -127,7 +133,10 @@ This example uses a form on a web page with a button that triggers the `POST` re
127133
"hook_attributes": {
128134
"url": "https://example.com/github/events",
129135
},
130-
"redirect_url": "https://example.com/callback",
136+
"redirect_url": "https://example.com/redirect",
137+
{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@next" or currentVersion ver_gt "enterprise-server@3.0" %}"callback_urls": [
138+
"https://example.com/callback"
139+
],{% else %}"callback_url": "https://example.com/callback",{% endif %}
131140
"public": true,
132141
"default_permissions": {
133142
"issues": "write",
@@ -147,11 +156,11 @@ This example uses a form on a web page with a button that triggers the `POST` re
147156

148157
When the person clicks **Create GitHub App**, GitHub redirects back to the `redirect_url` with a temporary `code` in a code parameter. For example:
149158

150-
https://example.com/callback?code=a180b1a3d263c81bc6441d7b990bae27d4c10679
159+
https://example.com/redirect?code=a180b1a3d263c81bc6441d7b990bae27d4c10679
151160

152161
If you provided a `state` parameter, you will also see that parameter in the `redirect_url`. For example:
153162

154-
https://example.com/callback?code=a180b1a3d263c81bc6441d7b990bae27d4c10679&state=abc123
163+
https://example.com/redirect?code=a180b1a3d263c81bc6441d7b990bae27d4c10679&state=abc123
155164

156165
#### 3. You exchange the temporary code to retrieve the app configuration
157166

content/developers/apps/creating-a-github-app-using-url-parameters.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ The person creating the app can edit the preselected values from the {% data var
2222

2323
The following URL creates a new public app called `octocat-github-app` with a preconfigured description and callback URL. This URL also selects read and write permissions for `checks`, subscribes to the `check_run` and `check_suite` webhook events, and selects the option to request user authorization (OAuth) during installation:
2424

25-
```
26-
{% data variables.product.oauth_host_code %}/settings/apps/new?name=octocat-github-app&description=An%20Octocat%20App&callback_url=https://example.com&request_oauth_on_install=true&public=true&checks=write&events[]=check_run&events[]=check_suite
27-
```
25+
{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@next" or currentVersion ver_gt "enterprise-server@3.0" %}
26+
```
27+
{% data variables.product.oauth_host_code %}/settings/apps/new?name=octocat-github-app&description=An%20Octocat%20App&callback_urls[]=https://example.com&request_oauth_on_install=true&public=true&checks=write&events[]=check_run&events[]=check_suite
28+
```
29+
{% else %}
30+
```
31+
{% data variables.product.oauth_host_code %}/settings/apps/new?name=octocat-github-app&description=An%20Octocat%20App&callback_url=https://example.com&request_oauth_on_install=true&public=true&checks=write&events[]=check_run&events[]=check_suite
32+
```
33+
{% endif %}
2834

2935
The complete list of available query parameters, permissions, and events is listed in the sections below.
3036

@@ -34,8 +40,9 @@ The complete list of available query parameters, permissions, and events is list
3440
-----|------|-------------
3541
`name` | `string` | The name of the {% data variables.product.prodname_github_app %}. Give your app a clear and succinct name. Your app cannot have the same name as an existing GitHub user, unless it is your own user or organization name. A slugged version of your app's name will be shown in the user interface when your integration takes an action.
3642
`description` | `string` | A description of the {% data variables.product.prodname_github_app %}.
37-
`url` | `string` | The full URL of your {% data variables.product.prodname_github_app %}'s website homepage.
38-
`callback_url` | `string` | The full URL to redirect to after someone authorizes an installation. This URL is used if your app needs to identify and authorize user-to-server requests.
43+
`url` | `string` | The full URL of your {% data variables.product.prodname_github_app %}'s website homepage.{% if currentVersion == "free-pro-team@latest" or currentVersion == "github-ae@next" or currentVersion ver_gt "enterprise-server@3.0" %}
44+
`callback_urls` | `array of strings` | A full URL to redirect to after someone authorizes an installation. You can provide up to 10 callback URLs. These URLs are used if your app needs to identify and authorize user-to-server requests. For example, `callback_urls[]=https://example.com&callback_urls[]=https://example-2.com`.{% else %}
45+
`callback_url` | `string` | The full URL to redirect to after someone authorizes an installation. This URL is used if your app needs to identify and authorize user-to-server requests.{% endif %}
3946
`request_oauth_on_install` | `boolean` | If your app authorizes users using the OAuth flow, you can set this option to `true` to allow people to authorize the app when they install it, saving a step. If you select this option, the `setup_url` becomes unavailable and users will be redirected to your `callback_url` after installing the app.
4047
`setup_url` | `string` | The full URL to redirect to after someone installs the {% data variables.product.prodname_github_app %} if the app requires additional setup after installation.
4148
`setup_on_update` | `boolean` | Set to `true` to redirect people to the setup URL when installations have been updated, for example, after repositories are added or removed.

0 commit comments

Comments
 (0)