1
- # oauth-login -url.js
1
+ # oauth-authorization -url.js
2
2
3
3
> Universal library to retrieve GitHub’s identity URL for the OAuth web flow
4
4
5
- [ ![ @latest ] ( https://img.shields.io/npm/v/@octokit/oauth-login -url.svg )] ( https://www.npmjs.com/package/@octokit/oauth-login -url )
6
- [ ![ Build Status] ( https://travis-ci.com/octokit/oauth-login -url.js.svg?branch=master )] ( https://travis-ci.com/octokit/oauth-login -url.js )
7
- [ ![ Greenkeeper] ( https://badges.greenkeeper.io/octokit/oauth-login -url.js.svg )] ( https://greenkeeper.io/ )
5
+ [ ![ @latest ] ( https://img.shields.io/npm/v/@octokit/oauth-authorization -url.svg )] ( https://www.npmjs.com/package/@octokit/oauth-authorization -url )
6
+ [ ![ Build Status] ( https://travis-ci.com/octokit/oauth-authorization -url.js.svg?branch=master )] ( https://travis-ci.com/octokit/oauth-authorization -url.js )
7
+ [ ![ Greenkeeper] ( https://badges.greenkeeper.io/octokit/oauth-authorization -url.js.svg )] ( https://greenkeeper.io/ )
8
8
9
9
See [ GitHub’s Developer Guide for the OAuth web application flow] ( https://developer.github.com/enterprise/2.16/apps/building-oauth-apps/authorizing-oauth-apps/#1-request-a-users-github-identity ) .
10
10
@@ -18,11 +18,11 @@ See [GitHub’s Developer Guide for the OAuth web application flow](https://deve
18
18
</th>
19
19
<td width=100%>
20
20
21
- Load ` @octokit/oauth-login -url ` directly from [ cdn.pika.dev] ( https://cdn.pika.dev )
21
+ Load ` @octokit/oauth-authorization -url ` directly from [ cdn.pika.dev] ( https://cdn.pika.dev )
22
22
23
23
``` html
24
24
<script type =" module" >
25
- import { oauthLoginUrl } from " https://cdn.pika.dev/@octokit/oauth-login -url" ;
25
+ import { oauthLoginUrl } from " https://cdn.pika.dev/@octokit/oauth-authorization -url" ;
26
26
</script >
27
27
```
28
28
@@ -33,49 +33,42 @@ Load `@octokit/oauth-login-url` directly from [cdn.pika.dev](https://cdn.pika.de
33
33
</th>
34
34
<td>
35
35
36
- Install with <code >npm install @octokit/oauth-login -url </code >
36
+ Install with <code >npm install @octokit/oauth-authorization -url </code >
37
37
38
38
``` js
39
- const { oauthLoginUrl } = require (" @octokit/oauth-login -url" );
40
- // or: import { oauthLoginUrl } from "@octokit/oauth-login -url";
39
+ const { oauthLoginUrl } = require (" @octokit/oauth-authorization -url" );
40
+ // or: import { oauthLoginUrl } from "@octokit/oauth-authorization -url";
41
41
```
42
42
43
43
</td ></tr >
44
44
</tbody >
45
45
</table >
46
46
47
47
``` js
48
- const {
49
- url,
50
- clientId,
51
- redirectUri,
52
- login,
53
- scopes,
54
- state
55
- } = oauthLoginUrl ({
56
- clientId: ' 1234567890abcdef1234' ,
57
- redirectUri: ' https://example.com' ,
58
- login: ' octocat' ,
59
- scopes: [' repo' , ' admin:org' ],
60
- state: ' secret123' ,
48
+ const { url , clientId , redirectUri , login , scopes , state } = oauthLoginUrl ({
49
+ clientId: " 1234567890abcdef1234" ,
50
+ redirectUri: " https://example.com" ,
51
+ login: " octocat" ,
52
+ scopes: [" repo" , " admin:org" ],
53
+ state: " secret123" ,
61
54
log: {
62
- warn (message ) {
63
- myLogger .log (message, { level: ' warn' })
55
+ warn (message ) {
56
+ myLogger .log (message, { level: " warn" });
64
57
}
65
58
}
66
- })
59
+ });
67
60
```
68
61
69
62
Override or set default options
70
63
71
64
``` js
72
65
const myLogin = login .defaults ({
73
- baseUrl: ' https://github.my-enterprise.com' ,
74
- defaultRedirectUri: ' https://app.my-enterprise.com' ,
75
- client: ' 1234567890abcdef1234'
76
- })
66
+ baseUrl: " https://github.my-enterprise.com" ,
67
+ defaultRedirectUri: " https://app.my-enterprise.com" ,
68
+ client: " 1234567890abcdef1234"
69
+ });
77
70
78
- location .href = oauthLoginUrl ().url
71
+ location .href = oauthLoginUrl ().url ;
79
72
```
80
73
81
74
## Options
0 commit comments