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

bug: Usinh Capacitor HTTP to send url form encoded POST requests does not work #6368

Closed
MGX-CODING opened this issue Mar 6, 2023 · 9 comments
Labels
needs reproduction needs reproducible example to illustrate the issue platform: android

Comments

@MGX-CODING
Copy link

Bug Report

Capacitor Version

  @capacitor/android: 4.6.3
  @capacitor/cli: 4.6.3
  @capacitor/ios: 4.6.3
  @capacitor/core: 4.6.3

Platform(s)

Android

Current Behavior

I am trying to use OAuth2 alongside Capacitor.
Everything works well on browser. On mobile, I need to use Capacitor HTTP plugin to bypass the CORS errors associated with my auth server (can't change that, not the point).

After hours of trying to find the issue, I stumbled across this : capacitor-community/http#270

And it seems to match my issue : when using capacitor HTTP plugin, url form encoded parameters are not being used correctly.

As explained, it works well on browser, but on Android, it's impossible to make it work.

I tried calling manually fetch with different bodies, but the issue is still the same : my server does not recognize the body, saying I have not provided the Grant type parameter, even when I have done it :

image

For reference, I am using this library : https://github.com/manfredsteyer/angular-oauth2-oidc
With the authorization_code workflow without PKCE (again, can't change that, not the point)

Expected Behavior

I would like for it to work out of the box.

I don't mind using a hack, a workaround, or anything of that flavor. I just want it to work. If you have any leads on why it happens, or how to bypass it, I'm all ears !

Code Reproduction

I'm sorry the environment to reproduce this is too complex. Maybe try making a simple HTTP server that accepts a form encoded request ?

Other Technical Details

npm --version output: 8.19.2

node --version output: v18.10.0

pod --version output (iOS issues only):

Additional Context

capacitor-community/http#270
capacitor-community/http#12

@ionitron-bot ionitron-bot bot added the triage label Mar 6, 2023
@ionitron-bot ionitron-bot bot removed the triage label Mar 6, 2023
@jcesarmobile jcesarmobile added the needs reproduction needs reproducible example to illustrate the issue label Mar 6, 2023
@Ionitron
Copy link
Collaborator

Ionitron commented Mar 6, 2023

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks!
Ionitron 💙

@Ionitron Ionitron added the needs reply needs reply from the user label Mar 6, 2023
@MGX-CODING

This comment was marked as abuse.

@Ionitron Ionitron removed the needs reply needs reply from the user label Mar 6, 2023
@jcesarmobile jcesarmobile added needs reproduction needs reproducible example to illustrate the issue and removed needs reproduction needs reproducible example to illustrate the issue labels Mar 6, 2023
@Ionitron
Copy link
Collaborator

Ionitron commented Mar 6, 2023

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks!
Ionitron 💙

@Ionitron Ionitron added the needs reply needs reply from the user label Mar 6, 2023
@MGX-CODING
Copy link
Author

Does "needs reproduction" involve me reproducing it, or you're labeling this as "we as the developers of the framework need to reproduce this issue first" ?

@Ionitron Ionitron removed the needs reply needs reply from the user label Mar 6, 2023
@ghost
Copy link

ghost commented Mar 21, 2023

@MGX-CODING I think you need to provide a reproduction. If you can pare it down to use some commonly available API like this one https://jsonplaceholder.typicode.com/ it'd help even more.

@nhh

This comment was marked as abuse.

@MGX-CODING
Copy link
Author

@jrobeson considering the cold shoulder I've been given (marking my comment as abusive and letting me intercat only with a chatbot), I decided to simply give up on this issue. I knew that Capacitor was terrible, now I know why, it simply reflects the personnality of their developers (not all of them I still hope though).

To resolve the issue, I asked for a CORS activation on the server, which took 3 weeks and had major side effects on other applications (huge enterprise). But now it's done, and I don't need to use this cursed package anymore.

And to answer you directly, there is already multiple examples online of the issue, I linked 2 of them already and @nhh just gave a third one. Choosing to just ignore them is either laziness or pettiness.

Taking all of that into account, if anyone encounters the issue, I would suggest them to find any workaround around it, rather than hoping for a resolution. That's my little bit of advice, hope it will serve one well !

@jcesarmobile
Copy link
Member

Sorry, I missed the comment with the question because I unsubscribed from the issue after you pinged me.
It's not cool to ping developers as you interfere with their notifications and subscribe them to the issues. They get marked as abuse because of that.

As jrobeson has mentioned, you (the reporter) have to provide a sample app where the issue can be reproduced.
You have provided links to similar issues, but none of them have sample apps that reproduce the issue. Also, the community http plugin is a separate plugin that was maintained by the community and has nothing to do with the Capacitor one, even if there was a sample app in there, it wouldn't be helpful for reproducing the issue in Capacitor.

If the reporter can't provide a sample app, anyone else facing the issue can comment with a sample app, but none did so far, as nhh's comment also brings a http plugin issue without sample app. He took the opportunity to downvote jrobeson's comment where he answered the question I didn't answer. That's also not cool.

We require full sample apps (zip or github repository) for being able to reproduce, even for paying customers. If we can't reproduce an issue, we can't fix it. I know http issues are specially tricky as they involve a server, but it's not impossible.
Users are reporting http plugin issues and they are providing sample apps, they use online services or some of them provide a small nodejs server script. Take KevinKelchen's issues as an example of awesome http plugin issues.
https://github.com/ionic-team/capacitor/issues/created_by/KevinKelchen

I'm locking the issue, if any of the people who has commented can provide a sample app they can edit their comment.
If somebody new wants to provide a sample app, they can create a new issue and I'll then close this one.
If a sample app is not provided within 15 days I'll manually close the issue as invalid.

@ionic-team ionic-team locked as too heated and limited conversation to collaborators Mar 24, 2023
@jcesarmobile
Copy link
Member

Closing since no sample app was provided

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs reproduction needs reproducible example to illustrate the issue platform: android
Projects
None yet
Development

No branches or pull requests

4 participants