Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token requests fail when using CordovaRequestor if http.setDataSerializer() is called in app code. #103

Open
mleech opened this issue Mar 28, 2022 · 4 comments

Comments

@mleech
Copy link
Contributor

mleech commented Mar 28, 2022

I had an issue where logins after the first one were hanging - ie SignInSuccess never got triggered.
It turns out it was because I called http.setDataSerializer('json') in my app and CordovaRequestor needs a serializer type of 'utf8'. The data serializer type is a global setting for some reason, and CordovaRequest only sets it once in it's constructor. If the value gets changed in app code then subsequent token requests can fail.

I've fixed my issue locally by using a customised version of CordovaRequest which calls http.setDataSerializer('utf8') inside the xhr() method so that it gets set correctly before each HTTP request.

@mraible
Copy link
Collaborator

mraible commented Aug 25, 2022

Can you contribute a PR that retains current functionality and adds this enhancement too?

mleech added a commit to mleech/ionic-appauth that referenced this issue Aug 26, 2022
@mleech
Copy link
Contributor Author

mleech commented Aug 26, 2022

@mraible I've created PR #142 based on code I've used locally.
A couple of issues I've noticed though:

  • I'm not sure it's a good idea to have the build output commited. Are contributers supposed to keep it updated with each PR? It's likely to lead to merge nightmares.
  • My local build is failing with a Cannot find module 'capacitor-secure-storage-plugin' ... error. Upon investigating it seems that in package-lock.json that this package is resolving to a local copy of the package:
     "resolved": "file:../capacitor-secure-storage-plugin/capacitor-secure-storage-plugin-0.8.0.tgz",

This was a change you made to master yesterday.

@mraible
Copy link
Collaborator

mraible commented Aug 26, 2022

I'll get the local file issue fixed in the morning (mountain time). Are you able to get the Angular Cordova demo working on iOS? I was unable to.

@mraible
Copy link
Collaborator

mraible commented Aug 26, 2022

@mleech I fixed the package-lock issue in #143. I also used Husky to add a pre-commit hook that builds when you commit. Hopefully, this will help contributors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants