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
## `react-linkedin-login-oauth2` version `2.0.0 alpha` is out with typescript and Next.js support. You can try it now by:
7
10
11
+
```shell
12
+
npm i react-linkedin-login-oauth2@alpha
13
+
```
14
+
15
+
## See the usages here [https://github.com/nvh95/react-linkedin-login-oauth2/tree/2.x#usage](https://github.com/nvh95/react-linkedin-login-oauth2/tree/2.x#usage). Migration guide is coming soon.
This package is used to get authorization code for Linked In Log in feature using OAuth2 in a easy way. After have the authorization code, you can send it to server to continue to get information needed. For more, please see at [Authenticating with OAuth 2.0 - Linked In](https://developer.linkedin.com/docs/oauth2)
17
-
See [Usage](#usage) and [Demo](#demo) for instruction.
25
+
See [Usage](#usage) and [Demo](#demo) for instruction.
18
26
19
27
## Table of contents
28
+
20
29
-[Changelog](#changelog)
21
30
-[Installation](#installation)
22
31
-[Overview](#overview)
@@ -27,18 +36,23 @@ See [Usage](#usage) and [Demo](#demo) for instruction.
27
36
-[Issues](#issues)
28
37
29
38
## Changelog
39
+
30
40
See [CHANGELOG.md](https://github.com/nvh95/react-linkedin-login-oauth2/blob/master/CHANGELOG.md)
31
41
32
42
## Installation
43
+
33
44
```
34
45
npm install --save react-linkedin-login-oauth2
35
46
```
36
47
37
48
## Overview
38
-
We will create a Linked In button (using `LinkedIn` component), after clicking on this button, a popup window will show up and ask for the permission. After we accepted, the pop up window will redirect to a specified URI which should be routed to `LinkedInPopUp` component. It has responsible to notice our openning app the authorization code Linked In provides us. You can consider using `react-router-dom` as a possible solution.
49
+
50
+
We will create a Linked In button (using `LinkedIn` component), after clicking on this button, a popup window will show up and ask for the permission. After we accepted, the pop up window will redirect to a specified URI which should be routed to `LinkedInPopUp` component. It has responsible to notice our openning app the authorization code Linked In provides us. You can consider using `react-router-dom` as a possible solution.
39
51
40
52
## Usage
53
+
41
54
First, we create a button and provide required props
55
+
42
56
```
43
57
import React, { Component } from 'react';
44
58
@@ -65,7 +79,7 @@ class LinkedInPage extends Component {
65
79
errorMessage: error.errorMessage,
66
80
});
67
81
}
68
-
82
+
69
83
render() {
70
84
const { code, errorMessage } = this.state;
71
85
return (
@@ -90,6 +104,7 @@ export default LinkedInPage;
90
104
```
91
105
92
106
Then we define a route to `redirect_url` and pass `LinkedInPopUp` to it as follow:
107
+
93
108
```
94
109
import React, { Component } from 'react';
95
110
import { LinkedInPopUp } from 'react-linkedin-login-oauth2';
@@ -113,7 +128,9 @@ class Demo extends Component {
113
128
```
114
129
115
130
### Usage with custom button
131
+
116
132
You can render your own component by provide `renderElement` as following example:
133
+
117
134
```
118
135
<LinkedIn
119
136
clientId="81lx5we2omq9xh"
@@ -125,13 +142,14 @@ You can render your own component by provide `renderElement` as following exampl
125
142
)}
126
143
/>
127
144
```
145
+
128
146
# Support IE
129
147
130
-
Earlier, this package might not work in IE11. The reason is that if popup and opener do not have same domain, popup cannot send message to opener. For more information about this, please visit [here](https://stackoverflow.com/questions/21070553/postmessage-still-broken-on-ie11). From `1.0.7`, we can bypass this by open a popup to our page, then redirect to Linked In authorization page, it should work fine. IE11 is supported in `1.0.7`. Following is step to support it. (If you don't have need to support IE, please ignore this part)
148
+
Earlier, this package might not work in IE11. The reason is that if popup and opener do not have same domain, popup cannot send message to opener. For more information about this, please visit [here](https://stackoverflow.com/questions/21070553/postmessage-still-broken-on-ie11). From `1.0.7`, we can bypass this by open a popup to our page, then redirect to Linked In authorization page, it should work fine. IE11 is supported in `1.0.7`. Following is step to support it. (If you don't have need to support IE, please ignore this part)
131
149
150
+
1. Pass prop `supportIE`
151
+
2. Pass `redirectPath` which has path route to `LinkedinPopUp` component, default value is `/linkedin` (for above example, `<Route exact path="/linkedin" component={LinkedInPopUp} />` => `redirectPath="/linkedin"`)
132
152
133
-
1. Pass prop `supportIE`
134
-
2. Pass `redirectPath` which has path route to `LinkedinPopUp` component, default value is `/linkedin` (for above example, `<Route exact path="/linkedin" component={LinkedInPopUp} />` => `redirectPath="/linkedin"`)
135
153
```
136
154
<LinkedIn
137
155
...
@@ -142,41 +160,48 @@ Earlier, this package might not work in IE11. The reason is that if popup and op
|||| See your app scope in `https://www.linkedin.com/developers/apps/${yourAppId}/auth`|
156
-
| onSuccess | function |yes||
157
-
| onFailure | function |yes||
158
-
| className | string |no|'btn-linkedin'|
159
-
| style | object |no||
160
-
| disabled | boolean |no|false|
161
-
| onClick | function |no||
162
-
| children | function |no|Linked in Signin button|
163
-
| renderElement | function |no|Render prop to use a custom element, use props.onClick|
164
-
| supportIE | boolean |no|false|
165
-
| redirectPath | function |no|/linkedin|
177
+
| onSuccess | function |yes||
178
+
| onFailure | function |yes||
179
+
| className | string |no|'btn-linkedin'|
180
+
| style | object |no||
181
+
| disabled | boolean |no|false|
182
+
| onClick | function |no||
183
+
| children | function |no|Linked in Signin button|
184
+
| renderElement | function |no|Render prop to use a custom element, use props.onClick|
185
+
| supportIE | boolean |no|false|
186
+
| redirectPath | function |no|/linkedin|
166
187
167
188
Read more about props here [https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context#step-2-request-an-authorization-code](https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context#step-2-request-an-authorization-code)
168
189
169
190
`LinkedinPopUp` component:
170
-
No parameters needed
191
+
No parameters needed
192
+
193
+
## Issues
171
194
172
-
## Issues
173
195
Please create an issue at [https://github.com/nvh95/react-linkedin-login-oauth2/issues](https://github.com/nvh95/react-linkedin-login-oauth2/issues). I will spend time to help you.
174
196
175
197
#### Failed to minify the code from this file: ./node_modules/react-linkedin-login-oauth2/node_modules/query-string/index.js:8
198
+
176
199
Please upgrade `react-linkedin-login-oauth2` to latest version following
200
+
177
201
```
178
202
npm install --save react-linkedin-login-oauth2
179
203
```
204
+
180
205
## Known issue
181
206
182
207
## Contributors ✨
@@ -203,4 +228,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
203
228
204
229
<!-- ALL-CONTRIBUTORS-LIST:END -->
205
230
206
-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
231
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
0 commit comments