react-native-spotify icon indicating copy to clipboard operation
react-native-spotify copied to clipboard

Cannot Clear Cookies on Webview - or log in with another account

Open afmire877 opened this issue 4 years ago • 4 comments

Hi @lufinkey,

Thanks for the amazing work on the package. I found it super helpful.

I am having an issue on clearing cookies and logging in with another user when I log out.

So when I log out, the webview remembers the previous user and automatically logging me in with old account. Also, I have logged in with a user that is not premium, I cannot go back. I am stuck.

I am have been pulling my hair with this problem. I looked into the Native Module, I see nothing.

I cannot seem to find the method that will clear the WebView so I can log in with an other account.

I am using "react-native": "0.61.5" "rn-spotify-sdk": "^1.2.14"

afmire877 avatar Jun 29 '20 23:06 afmire877

Sorry, I don't have time to fully add this feature right now, but there is some unused code:

Android; https://github.com/lufinkey/react-native-spotify/blob/275f534765a2879d9a000fb5a280d3667c904bb2/android/src/main/java/com/lufinkey/react/spotify/Auth.java#L147

iOS: https://github.com/lufinkey/react-native-spotify/blob/5dfce854f58743e58d631268e47a98de6f4c91b2/ios/RNSpotifyAuth.m#L106

Try messing with those and maybe adding calls to them in the clearSession functions. It doesn't look like the iOS version filters by the url, so I'd definitely try to get that to only clear spotify cookies.

lufinkey avatar Jul 05 '20 20:07 lufinkey

You can also use the { showDialog: true } option in the login function to force the dialog to reappear.

lufinkey avatar Jul 05 '20 20:07 lufinkey

Thanks @lufinkey.

I will look into it, if I do find a solution, i will share it.

Also, I have tried using { showDialog: true } but it does not open the dialog on IOS 13.

afmire877 avatar Jul 11 '20 14:07 afmire877

@afmire877 sorry for the late response on this. You can actually set a non-persistant website storage on WKWebView on iOS. This will prevent it from persisting cookies. There's no option for this in the module though so the module would have to be tweaked to account for it

lufinkey avatar Dec 08 '20 16:12 lufinkey