MaikuB / MaikuB/flutter_appauth
[Android] Browser is not redirecting the user back to the app
- Dominant language
- Objective-C
- Stars
- 308
- Forks
- 301
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 5
Description
I am implementing Google OAuth 2.0 for Flutter Android, but the browser is not redirecting the user back to the app. Do I need deep linking for this, or can I manage it through a custom URI?
I have created **Client ID for Web application** and added same redirect URL [https://companyname.com/api/oauth/google/callback](https://companyname.com/api/oauth/google/callback)
I also added domain [companyname.com](url) on **OAuth consent screen** under Authorized domains
**Here is my code**
**build.gradle**
```
defaultConfig {
manifestPlaceholders += [
appAuthRedirectScheme: 'https'
]
//other config
}
```
**AndroidManifest.xml**
```
```
**Flutter Code**
```
final FlutterAppAuth appAuth = FlutterAppAuth();
final AuthorizationTokenResponse? result =
await appAuth.authorizeAndExchangeCode(
AuthorizationTokenRequest(
'xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com',
'https://companyname.com/api/oauth/google/callback',
scopes: ['openid', 'profile', 'email'],
serviceConfiguration: AuthorizationServiceConfiguration(
authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth',
tokenEndpoint: 'https://oauth2.googleapis.com/token',
),
),
);
```
Contributor guide
Research direction
Start by reviewing build.gradle and AndroidManifest.xml alongside the FlutterAppAuth authorizeAndExchangeCode call and RedirectUriReceiverActivity configuration. Trace the configured redirect URI through the Android intent filter and OAuth request; done means the browser returns to the app and the authorization code exchange completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, 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