MaikuB / MaikuB/flutter_appauth

Android app crash when use flutter_appauth connect with http link

Open
#131 8 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
308
Forks
301
Avg merge
2d 11h
Merged PRs (30d)
5

Description

I am getting this error if I am trying to use http. My app on IOS run well but android not word. I try to change https link and it work well. However our test environment uses http link. Is there any way to use http instead of https?

```
Caused by: java.lang.IllegalArgumentException: only https connections are permitted
at net.openid.appauth.Preconditions.checkArgument(Preconditions.java:116)
at net.openid.appauth.connectivity.DefaultConnectionBuilder.openConnection(DefaultConnectionBuilder.java:51)
at net.openid.appauth.AuthorizationServiceConfiguration$ConfigurationRetrievalAsyncTask.doInBackground(AuthorizationServiceConfiguration.java:327)
at net.openid.appauth.AuthorizationServiceConfiguration$ConfigurationRetrievalAsyncTask.doInBackground(AuthorizationServiceConfiguration.java:305)
at android.os.AsyncTask$2.call(AsyncTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:246) 
at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:784) 
```

I've tried add **_allowInsecureConnections_** to **true**, and add attribute **android:usesCleartextTraffic="true"** to node application in **AndroidManifest.xml** follow issues [12](https://github.com/MaikuB/flutter_appauth/issues/12) but it does not work . The application runs fine when I use the **https** link.

Version
flutter_appauth: 0.9.2

```
final AuthorizationResponse result = await _appAuth.authorize(
AuthorizationRequest(_clientId, _redirectUrl,
promptValues: ['login'],
allowInsecureConnections: true,
discoveryUrl: _discoveryUrl, scopes: _scopes, loginHint: 'bob'),
);
```
```


...

```

I would be thankfull if you can help me with the aformentioned problem.

thank you in advance
best regards

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported AuthorizationRequest and AndroidManifest.xml configuration, then trace the failure through DefaultConnectionBuilder.openConnection and AuthorizationServiceConfiguration. Reproduce with the flutter_appauth 0.9.2 example using the supplied HTTP discovery URL and compare it with HTTPS; done means HTTP behavior is understood and any supported configuration is documented or verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, java
Domain
authentication, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.