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
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.
17
+
See [Usage](#usage) and [Demo](#demo) for instruction.
18
18
19
19
## Table of contents
20
+
20
21
-[Changelog](#changelog)
21
22
-[Installation](#installation)
22
23
-[Overview](#overview)
@@ -27,18 +28,23 @@ See [Usage](#usage) and [Demo](#demo) for instruction.
27
28
-[Issues](#issues)
28
29
29
30
## Changelog
31
+
30
32
See [CHANGELOG.md](https://github.com/nvh95/react-linkedin-login-oauth2/blob/master/CHANGELOG.md)
31
33
32
34
## Installation
35
+
33
36
```
34
37
npm install --save react-linkedin-login-oauth2
35
38
```
36
39
37
40
## 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.
41
+
42
+
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 `LinkedInCallback` 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
43
40
44
## Usage
45
+
41
46
First, we create a button and provide required props
47
+
42
48
```
43
49
import React, { Component } from 'react';
44
50
@@ -65,7 +71,7 @@ class LinkedInPage extends Component {
65
71
errorMessage: error.errorMessage,
66
72
});
67
73
}
68
-
74
+
69
75
render() {
70
76
const { code, errorMessage } = this.state;
71
77
return (
@@ -89,10 +95,11 @@ class LinkedInPage extends Component {
89
95
export default LinkedInPage;
90
96
```
91
97
92
-
Then we define a route to `redirect_url` and pass `LinkedInPopUp` to it as follow:
98
+
Then we define a route to `redirect_url` and pass `LinkedInCallback` to it as follow:
99
+
93
100
```
94
101
import React, { Component } from 'react';
95
-
import { LinkedInPopUp } from 'react-linkedin-login-oauth2';
102
+
import { LinkedInCallback } from 'react-linkedin-login-oauth2';
96
103
97
104
import { render } from 'react-dom';
98
105
import { BrowserRouter, Route, Switch } from 'react-router-dom';
@@ -103,7 +110,7 @@ class Demo extends Component {
@@ -113,7 +120,9 @@ class Demo extends Component {
113
120
```
114
121
115
122
### Usage with custom button
123
+
116
124
You can render your own component by provide `renderElement` as following example:
125
+
117
126
```
118
127
<LinkedIn
119
128
clientId="81lx5we2omq9xh"
@@ -125,13 +134,14 @@ You can render your own component by provide `renderElement` as following exampl
125
134
)}
126
135
/>
127
136
```
137
+
128
138
# Support IE
129
139
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)
140
+
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
141
142
+
1. Pass prop `supportIE`
143
+
2. Pass `redirectPath` which has path route to `LinkedInCallback` component, default value is `/linkedin` (for above example, `<Route exact path="/linkedin" component={LinkedInCallback} />` => `redirectPath="/linkedin"`)
132
144
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
145
```
136
146
<LinkedIn
137
147
...
@@ -142,41 +152,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|
169
+
| onSuccess | function |yes||
170
+
| onFailure | function |yes||
171
+
| className | string |no|'btn-linkedin'|
172
+
| style | object |no||
173
+
| disabled | boolean |no|false|
174
+
| onClick | function |no||
175
+
| children | function |no|Linked in Signin button|
176
+
| renderElement | function |no|Render prop to use a custom element, use props.onClick|
177
+
| supportIE | boolean |no|false|
178
+
| redirectPath | function |no|/linkedin|
166
179
167
180
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
181
169
-
`LinkedinPopUp` component:
170
-
No parameters needed
182
+
`LinkedInCallback` component:
183
+
No parameters needed
184
+
185
+
## Issues
171
186
172
-
## Issues
173
187
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
188
175
189
#### Failed to minify the code from this file: ./node_modules/react-linkedin-login-oauth2/node_modules/query-string/index.js:8
190
+
176
191
Please upgrade `react-linkedin-login-oauth2` to latest version following
192
+
177
193
```
178
194
npm install --save react-linkedin-login-oauth2
179
195
```
196
+
180
197
## Known issue
181
198
182
199
## Contributors ✨
@@ -203,4 +220,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
203
220
204
221
<!-- ALL-CONTRIBUTORS-LIST:END -->
205
222
206
-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
223
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
0 commit comments