Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deferred login on android doesn't catch intent-filter callback #276

Closed
Ruslan-Mz opened this issue May 6, 2022 · 1 comment
Closed

Deferred login on android doesn't catch intent-filter callback #276

Ruslan-Mz opened this issue May 6, 2022 · 1 comment

Comments

@Ruslan-Mz
Copy link

Ruslan-Mz commented May 6, 2022

Hello!

Can you please check if this is a bug on RN side, or maybe on Android SDK side? Or maybe there's just something missing in the configuration?

I've created an app from this template https://github.com/forcedotcom/SalesforceMobileSDK-Templates/tree/dev/ReactNativeDeferredTemplate
Uncommented login activity and intent-filter for it:
AndroidManifest.xml:

        <activity android:name="com.salesforce.androidsdk.ui.LoginActivity"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"
            android:launchMode="singleInstance"
            android:exported="true">

            <intent-filter>
                <data android:scheme="testsfdc"
                    android:host="*"
                    android:path="/mobilesdk/detect/oauth/done" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

I haven't changed any callbacks or hosts - logging in to sandbok test.salesforce.com with our test user
Login succeeds, but I'm returned on main page without getting login callback, the page still have a button "Login"

app.js:

onLogin() {
        console.log("onLogin called");
        oauth.authenticate(
            (data) => { <———————- NOT CALLED!
                console.log("login completed ", data);
                this.fetchData(data)
            },
            (error) => {console.log('login failed:' + error)}
        );        
    }

I've cheked intent filters, documentation, have put some logs in the LoginActivity in the SDK to see if it's called, and I see that method "finish" is called, but new intent is not.

If I press "Login" button on main page again - then I'm authenticated without opening web view and I receive the data. Button on main page changes to "Logout" as expected.

In case I disable deferred login, everything works on first attempt - I'm logged in on return from web view and I dont need to press login again.

The issue is that without callback on first login attempt it's not clear if user is logged in or no. LoginActivity just closes.

@Ruslan-Mz Ruslan-Mz changed the title Deferred login on android doesnt catch intent-filter callback Deferred login on android doesn't catch intent-filter callback May 6, 2022
@Ruslan-Mz
Copy link
Author

Found out that it's because of the already reported bug: #247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant