From 94ba11570aa06c499988c4184e7d60f9f6fbdaf7 Mon Sep 17 00:00:00 2001 From: Dan Pina Date: Mon, 4 Dec 2023 18:22:14 +0100 Subject: [PATCH 1/2] Update LinkedIn scopes --- CHANGELOG.md | 6 ++++++ README.md | 2 +- examples/nextjs/pages/index.js | 2 +- preview/LinkedInPageHook.jsx | 2 +- preview/LinkedInPageRenderProps.jsx | 2 +- src/useLinkedIn.tsx | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9699453..eda5f58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 2.0.2 + +## Features + +- Update LinkedIn scopes + # 2.0.1 ## Features diff --git a/README.md b/README.md index c2db13c..5c900a6 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ export default function LinkedInPage() { | onSuccess | function | yes | | | onError | function | no | | | state | string | no | randomly generated string (recommend to keep default value) | -| scope | string | no | 'r_emailaddress' | +| scope | string | no | 'email' | | | | | See your app scope [here](https://docs.microsoft.com/en-us/linkedin/shared/authentication/authentication?context=linkedin/context#permission-types). If there are more than one, delimited by a space | | children | function | no | Require if using `LinkedIn` component (render props) | diff --git a/examples/nextjs/pages/index.js b/examples/nextjs/pages/index.js index 5637e2f..906a344 100644 --- a/examples/nextjs/pages/index.js +++ b/examples/nextjs/pages/index.js @@ -19,7 +19,7 @@ export default function Home() { console.log(code); setCode(code); }, - scope: 'r_emailaddress', + scope: 'email', onError: (error) => { console.log(error); setErrorMessage(error.errorMessage); diff --git a/preview/LinkedInPageHook.jsx b/preview/LinkedInPageHook.jsx index 67c0d58..d63307e 100644 --- a/preview/LinkedInPageHook.jsx +++ b/preview/LinkedInPageHook.jsx @@ -11,7 +11,7 @@ function LinkedInPage() { console.log(code); setCode(code); }, - scope: 'r_emailaddress', + scope: 'email', onError: (error) => { console.log(error); setErrorMessage(error.errorMessage); diff --git a/preview/LinkedInPageRenderProps.jsx b/preview/LinkedInPageRenderProps.jsx index b63cfc2..ce98e03 100644 --- a/preview/LinkedInPageRenderProps.jsx +++ b/preview/LinkedInPageRenderProps.jsx @@ -18,7 +18,7 @@ function LinkedInPage() { console.log(code); setCode(code); }} - scope="r_emailaddress r_liteprofile" + scope="email profile" onError={(error) => { console.log(error); setErrorMessage(error.errorMessage); diff --git a/src/useLinkedIn.tsx b/src/useLinkedIn.tsx index 471be2d..a1d242a 100644 --- a/src/useLinkedIn.tsx +++ b/src/useLinkedIn.tsx @@ -24,7 +24,7 @@ export function useLinkedIn({ clientId, onSuccess, onError, - scope = 'r_emailaddress', + scope = 'email', state = '', closePopupMessage = 'User closed the popup', }: useLinkedInType) { From 9ac307eca7f4946a08c2d7c8380e159d4bb19ce9 Mon Sep 17 00:00:00 2001 From: Dan Pina Date: Mon, 4 Dec 2023 18:25:22 +0100 Subject: [PATCH 2/2] Added possible scopes to README --- CHANGELOG.md | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eda5f58..adc1e2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Features - Update LinkedIn scopes +- Added possible scopes to README # 2.0.1 diff --git a/README.md b/README.md index 5c900a6..a49c3b3 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ export default function LinkedInPage() { | onError | function | no | | | state | string | no | randomly generated string (recommend to keep default value) | | scope | string | no | 'email' | -| | | | See your app scope [here](https://docs.microsoft.com/en-us/linkedin/shared/authentication/authentication?context=linkedin/context#permission-types). If there are more than one, delimited by a space | +| | | | Possible scopes: `email`, `profile` and `openid`. See your app scope [here](https://docs.microsoft.com/en-us/linkedin/shared/authentication/authentication?context=linkedin/context#permission-types). If there are more than one, delimited by a space | | children | function | no | Require if using `LinkedIn` component (render props) | Reference: [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)