nvh95 / react-linkedin-login-oauth2

Easily get Authorization Code from Linked In to log in without redirecting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Having problem with the popup close

realAudi opened this issue · comments

Originally when I tried this module, I was getting a behaviour where after LinkedIn authorized, my return URL would render in the popup, rather than close and pass back the token. Then at one point it just started to work properly. Then I compiled and it went back to the original behaviour of not closing the popup.
I have embedded

the component in my own page (coverpage). And for debugging purposes taken your code and put it under my utilis folder, just so I can add console.log debugs and figure out whats going on.
I think it's in the eventlistener attachment, as I cannot see any of these events registered in the tools window attached to the document of the popup. But I am not sure. It could also have something todo with the browser router as I am embedding it in another page... I am not quite certain what the intent of the router is here.
Below you can see the code for the relevant files. let me know if you need anything else.
T
linkedin_debugging.zip
hanks- I have been pulling my hair out for 2 days on this.

oh sorry I forgot. You can look at the app at
ayda.io:8080
although here I have changed the popup to be "parent" just to get it to pass back to me the auth code and proceed

Hey @realAudi
Sorry but I haven't gotten your problem.
I tried on ayda.io:8080 but what I got back after successfully authorized is that I am redirected to your localhost:3000
Can you specify your problem you are facing a little bit clearer. If there is a video attached, it would be very helpful.
Thanks.

@realAudi
Hey, I looked into your source code and I see what is the problem here.
I think that you are not redirected in parent window because you pass the wrong URI in redirectUri
I think with your source code, you should pass

redirectUri={`${window.location.origin}/linkedin`}

Let me explain a little bit what we will do here.
When you include <LinkedIn />, I put an event listener here.
After authorized, the popup window will redirect to /linkedin (still in popup window), then from here, it will emit an event to parent window that it is successfully authorized and close the current popup window in the same time. (/linkedin should route to LinkedInPopUp in react-linkedin-login-oauth2)
I think that the example I wrote maybe confuse you a bit. Please let me know if you can fix that or you need more help from me.

Regards.

@realAudi My pleasure. Let me know if you need any help.
Thanks.

Event Listener is not working in redux form.