You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+59-5Lines changed: 59 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,17 @@
7
7
8
8
See [GitHub’s Developer Guide for the OAuth App web application flow](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). Note that the [OAuth web application flow for GitHub Apps](https://docs.github.com/en/developers/apps/identifying-and-authorizing-users-for-github-apps#web-application-flow) is slightly different. GitHub Apps do not support scopes for its user access tokens (they are called user-to-server tokens for GitHub Apps), instead they inherit the user permissions from the GitHub App's registration and the repository/organization access and permissions from the respective installation.
const { url, clientId, redirectUrl, login, state } =oauthAuthorizationUrl({
81
+
clientType:"github-app",
82
+
clientId:"lv1.1234567890abcdef",
83
+
redirectUrl:"https://example.com",
84
+
login:"octocat",
85
+
state:"secret123",
86
+
});
87
+
```
88
+
63
89
## Options
64
90
65
91
<table>
@@ -82,6 +108,16 @@ const {
82
108
<strong>Required</strong>. The client ID you received from GitHub when you registered.
83
109
</td>
84
110
</tr>
111
+
<tr>
112
+
<th>
113
+
<code>clientType</code>
114
+
</th>
115
+
<td>
116
+
117
+
Must be set to either `"oauth-app"` or `"github-app"`. Defaults to `"oauth-app"`.
118
+
119
+
</td>
120
+
</tr>
85
121
<tr>
86
122
<th>
87
123
<code>redirectUrl</code>
@@ -103,8 +139,14 @@ const {
103
139
<code>scopes</code>
104
140
</th>
105
141
<td>
106
-
An array of scope names (or: space-delimited list of scopes). If not provided, scope defaults to an empty list for users that have not authorized any scopes for the application. For users who have authorized scopes for the application, the user won't be shown the OAuth authorization page with the list of scopes. Instead, this step of the flow will automatically complete with the set of scopes the user has authorized for the application. For example, if a user has already performed the web flow twice and has authorized one token with user scope and another token with repo scope, a third web flow that does not provide a scope will receive a token with user and repo scope.
107
-
</td>
142
+
143
+
Only relevant when `clientType` is set to `"oauth-app"`.
144
+
145
+
An array of scope names (or: space-delimited list of scopes). If not provided, scope defaults to an empty list for users that have not authorized any scopes for the application. For users who have authorized scopes for the application, the user won't be shown the OAuth authorization page with the list of scopes. Instead, this step of the flow will automatically complete with the set of scopes the user has authorized for the application. For example, if a user has already performed the web flow twice and has authorized one token with user scope and another token with repo scope, a third web flow that does not provide a scope will receive a token with user and repo scope.
146
+
147
+
Defaults to `[]` if `clientType` is set to `"oauth-app"`.
148
+
149
+
</td>
108
150
</tr>
109
151
<tr>
110
152
<th>
@@ -120,7 +162,7 @@ const {
120
162
<code>allowSignup</code>
121
163
</th>
122
164
<td>
123
-
Whether or not unauthenticated users will be offered an option to sign up for GitHub during the OAuth flow. The default is <code>true</code>. Use <code>false</code> in the case that a policy prohibits signups.
165
+
Whether or not unauthenticated users will be offered an option to sign up for GitHub during the OAuth flow. Use <code>false</code> in the case that a policy prohibits signups. Defaults to <code>true</code>.
124
166
</td>
125
167
</tr>
126
168
<tr>
@@ -158,6 +200,14 @@ const {
158
200
Returns <code>options.allowSignup</code> if it was set. Defaults to <code>true</code>.
159
201
</td>
160
202
</tr>
203
+
<tr>
204
+
<th>
205
+
<code>clientType</code>
206
+
</th>
207
+
<td>
208
+
Returns <code>options.clientType</code>. Defaults to <code>"oauth-app"</code>.
209
+
</td>
210
+
</tr>
161
211
<tr>
162
212
<th>
163
213
<code>clientId</code>
@@ -187,8 +237,12 @@ const {
187
237
<code>scopes</code>
188
238
</th>
189
239
<td>
190
-
Always returns an array of strings. Returns <code>options.scopes</code> if it was set and turns the string into an array if a string was passed. Defaults to <code>[]</code>.
191
-
</td>
240
+
241
+
Only set if `options.clientType` is set to `"oauth-app"`.
242
+
243
+
Returns an array of strings. Returns <code>options.scopes</code> if it was set and turns the string into an array if a string was passed, otherwise <code>[]</code>.
0 commit comments