Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Can this plugin override all HTTP calls? #45

@mraible

Description

@mraible

Describe the bug

I'm trying to use Okta's Angular SDK and Sign-In Widget to embed a login form in my Ionic + Capacitor application. Everything works fine when I run it in my browser. When I try to run it in iOS Simulator, I get the following error:

Origin capacitor://localhost is not allowed by Access-Control-Allow-Origin.

I've known about this issue in the past and thought adding this plugin would solve the problem. Okta only allows http/s schemes for its Trusted Origins, and they're not (currently) willing to add support for capacitor://.

I tried installing this plugin to fix the problem:

npm install @capacitor-community/http
npx cap sync

Unfortunately, it still happens.

If I run the following command, it does use http://localhost:8100 as the origin instead of capacitor://localhost.

ionic capacitor run ios -l --host=localhost

To Reproduce
Steps to reproduce the behavior:

git clone -b angular-sdk https://github.com/oktadeveloper/okta-ionic-social-login-example
cd okta-ionic-social-login-example
npm i
npm run build
ionic capacitor add ios

Run app in Xcode, click Login, debug with Safari and you'll see the invalid origin error.

Expected behavior

This plugin overrides all origin headers to use http://localhost:8100 rather than capacitor://localhost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions