react-linkedin-login-oauth2 icon indicating copy to clipboard operation
react-linkedin-login-oauth2 copied to clipboard

onSuccess is called twice

Open iners-max opened this issue 2 years ago • 9 comments

When I get the authorization code from the onSuccess callback, I will try to retrieve an access token from LinkedIn. However, I found that the onSuccess callback is always called twice with the same authorization code. It will trigger my function to LinkedIn twice causing LinkedIn to return an error saying my authorization code is expired in the second call.

Is it intented?

iners-max avatar Aug 08 '22 13:08 iners-max

Same for me

raoularavel avatar Nov 13 '22 07:11 raoularavel

i am having same issue plz help

tripathiaakasah avatar Dec 23 '22 10:12 tripathiaakasah

By any chance the component hosting the hook is getting rendered twice? or can you provide some more context on the usage?

mamankhan99 avatar Jan 03 '23 10:01 mamankhan99

I had the same issue in development due to <React.StrictMode> Removed them and the issue is gone.

kallsbo avatar Jan 14 '23 20:01 kallsbo

@kallsbo Thanks, This works

pasindu1997 avatar Jan 24 '23 04:01 pasindu1997

Same issue coming for me! Strict mode didn't solve the issue, still being called twice!

ayushsanjtgs avatar May 23 '23 08:05 ayushsanjtgs

Removing <React.StrictMode> works but how onSuccess is getting triggered second time and there should be some solution for this

gauravp-dev avatar Sep 06 '23 17:09 gauravp-dev

I am having same is there any solution to that apart from removing StrictMode

gauravp-dev avatar Sep 29 '23 10:09 gauravp-dev