LinusU / LinusU/flutter_web_auth

OAuth2 redirect issues

Open
#93 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
213
Forks
261
PR merge metrics
No merged PRs in 30d

Description

Hello, I've read previous issues similar as mine but I still can't manage to make it work with all this information

So, as I understood your scheme needs to be structured as following : domain.company.name
and the idea would be that your url is just your scheme + ://

(Just to clarify, I'm trying to use Reddit's Oauth, with reddit you need to create a dev app and get your clientID and secrets (https://www.reddit.com/prefs/apps))

The thing is I can't just put domain.company.name:// as url in here :

![image](https://user-images.githubusercontent.com/58589179/136706155-71848589-234c-49b2-acb5-a5062879a8af.png)

So what I did previously was putting http://127.0.0.1:65010/authorize_callaback and http as scheme.

My issue is that when I click on accept to authorize with OAuth2 it gets me here when it's supposed to go back on the app :

![image](https://user-images.githubusercontent.com/58589179/136706243-e3207434-4c68-4bc7-9627-5c792ffc1570.png)

Even tho I get my token in the url : http://127.0.0.1:65010/authorize_callback?state=random_string&code=_2stEhVnH294rcna_DqnRGKRv3w1lw#_

I'm really stuck here so if anyone can help me that would be great, here is my code :

main.dart :
```
final url = Uri.https('www.reddit.com', '/api/v1/authorize.compact', {
'client_id': googleClientId,
'response_type': 'code',
'state': '$randomString',
'redirect_uri': 'http://127.0.0.1:65010/authorize_callback',
'duration': '$timeVariable',
'scope': '$scopeList',
});
final result = await FlutterWebAuth.authenticate(
url: url.toString(), callbackUrlScheme: "http", preferEphemeral: true);

```
AndroidManifest.xml :

(I didn't put this inside the .MainActivity)

```







```
Thanks

Contributor guide

No contributing guide indexed for this repository

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 main.dart and the AndroidManifest.xml CallbackActivity declaration, then trace the FlutterWebAuth.authenticate call and Reddit OAuth redirect shown in the report. Reproduce the authorization flow and verify how the callback URL is matched; done means the OAuth callback returns to the app rather than stopping in the browser.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.