-
Notifications
You must be signed in to change notification settings - Fork 391
@W-17964655: [Android] WSC discovery endpoint to postpone OAuth flow #2736
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
Merged
JohnsonEricAtSalesforce
merged 6 commits into
forcedotcom:dev
from
JohnsonEricAtSalesforce:feature/w-17964655_android-wsc-discovery-endpoint-to-postpone-oauth-flow
Jul 23, 2025
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1366647
@W-17964655: [Android] WSC discovery endpoint to postpone OAuth flow
JohnsonEricAtSalesforce f36cbd8
@W-17964655: [Android] WSC discovery endpoint to postpone OAuth flow …
JohnsonEricAtSalesforce 1b4d8ee
@W-17964655: [Android] WSC discovery endpoint to postpone OAuth flow …
JohnsonEricAtSalesforce f20120b
@W-17964655: [Android] WSC discovery endpoint to postpone OAuth flow …
JohnsonEricAtSalesforce e437641
@W-17964655: [Android] WSC discovery endpoint to postpone OAuth flow …
JohnsonEricAtSalesforce ff78c26
@W-17964655: [Android] WSC discovery endpoint to postpone OAuth flow …
JohnsonEricAtSalesforce File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<servers> | ||
<server name="Production" url="https://login.salesforce.com" /> | ||
<server name="Welcome" url="https://welcome.salesforce.com" /> | ||
<server name="Welcome" url="https://welcome.salesforce.com/discovery" /> | ||
<server name="Sandbox" url="https://test.salesforce.com" /> | ||
</servers> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
import android.content.SharedPreferences; | ||
import android.content.SharedPreferences.Editor; | ||
import android.content.res.XmlResourceParser; | ||
import android.os.Looper; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.lifecycle.MutableLiveData; | ||
|
@@ -61,7 +62,7 @@ public class LoginServerManager { | |
|
||
// Default login servers. | ||
public static final String PRODUCTION_LOGIN_URL = "https://login.salesforce.com"; | ||
public static final String WELCOME_LOGIN_URL = "https://welcome.salesforce.com"; | ||
public static final String WELCOME_LOGIN_URL = "https://welcome.salesforce.com/discovery"; | ||
public static final String SANDBOX_LOGIN_URL = "https://test.salesforce.com"; | ||
|
||
// Keys used in shared preferences. | ||
|
@@ -167,7 +168,11 @@ public void setSelectedLoginServer(LoginServer server) { | |
edit.putString(SERVER_URL, server.url); | ||
edit.putBoolean(IS_CUSTOM, server.isCustom); | ||
edit.apply(); | ||
selectedServer.postValue(server); | ||
if (Looper.myLooper() == Looper.getMainLooper()) { | ||
selectedServer.setValue(server); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This optimization uses the synchronous |
||
} else { | ||
selectedServer.postValue(server); | ||
} | ||
} | ||
|
||
/** | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wmathurin - I've set up the MSDK logic to distinguish Salesforce Welcome Discovery URLs by the path element. According to our convention, that works and doesn't require us to add an UX for the user to specify if they're entering discovery URL in the "Add Connection" bottom sheet.
Alternately, we could add some way for the user to check-off that the scheme and host they've entered is for discovery and then add this path in the MSDK logic. That seemed more intrusive to the user, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to other ideas. This seemed to keep it simple, at first blush.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The end user wouldn't know if the app developer is using a scheme and host for discovery, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. We also don't have a specification for what this will look like beyond internal use, so it might change.