capacitor-community / capacitor-community/generic-oauth2

Response not returned to calling javascript on Android

Open
#271 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
281
Forks
129
PR merge metrics
No merged PRs in 30d

Description

### Description

Trying to use Google OAuth on Web+Android. Works fine in SPA. On Android, I see that the token is obtained successfully in the logs, but it is not returned to javascript successfully.

### Capacitor version:
Output of `npx cap doctor`:

```
Latest Dependencies:

@capacitor/cli: 6.1.2
@capacitor/core: 6.1.2
@capacitor/android: 6.1.2

Installed Dependencies:

@capacitor/cli: 6.1.2
@capacitor/core: 6.1.2
@capacitor/android: 6.1.2

[success] Android looking great! 👌
```

### Library version:
Using version 6.1.0 of the library.

### OAuth Provider:

- Google

### Your Plugin Configuration

```typescript
{
authorizationBaseUrl: 'https://accounts.google.com/o/oauth2/auth',
accessTokenEndpoint: 'https://www.googleapis.com/oauth2/v4/token',
scope: 'email profile',
resourceUrl: 'https://www.googleapis.com/userinfo/v2/me',
logsEnabled: false,
web: {
appId: config.public.googleWebClientId,
accessTokenEndpoint: '',
responseType: 'token',
windowTarget: '_self',
redirectUrl: `${config.public.appURL}/${action}/google`,
},
android: {
appId: config.public.googleAndroidClientId,
redirectUrl: `${config.public.androidPackageId}:/`,
responseType: 'code',
pkceEnabled: true,
}
}
```

### Affected Platform(s):

* Android
* Version/API Level:
* Device Model:
* Content of your `AndroidManifest.xml`

```xml






















```

Contributor guide

Open the contributing guide

Research direction

Review the provided AndroidManifest.xml and MainActivity callback entry point alongside the TypeScript OAuth configuration. Reproduce the Google OAuth flow with the listed Capacitor and library versions, then trace whether the obtained token reaches JavaScript. Done means the Android flow returns its OAuth response to the calling JavaScript code.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, typescript
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.