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

Remove cancel button login #152

Closed
chaitba2 opened this issue Dec 4, 2023 · 5 comments
Closed

Remove cancel button login #152

chaitba2 opened this issue Dec 4, 2023 · 5 comments
Assignees
Labels

Comments

@chaitba2
Copy link

chaitba2 commented Dec 4, 2023

Hi,

I used your library to integrate Salesforce into my app.
It is easy to use and very helpful.

I would like to remove the cancel button from the Login widget. And am not able to find a way to remove it.
Could you please point me in the direction where I can achieve this implementation?

Also is there a way to bypass login alert?

Thanks in advance.,

@mike4aday mike4aday self-assigned this Dec 4, 2023
@mike4aday
Copy link
Owner

Hi @chaitba2. To the best of my knowledge, it's not possible to remove the "Cancel" button from the top left of Apple's presented authentication view. Swiftly Salesforce users ASWebAuthenticationSession and there isn't a configuration parameter to hide the "Cancel" button -- which may be for the best, since there needs to be a way for the user to dismiss the modal.

Swiftly Salesforce will return a cancellation error if the user does tap "Cancel" - that is, you can detect the difference between the user canceling the Salesforce authentication vs. failing to authenticate.

@mike4aday
Copy link
Owner

@chaitba2 I will mark this issue as 'closed' but if I didn't answer your question, please reopen.

@mike4aday
Copy link
Owner

@chaitba2 I realized I forgot to address your second question: "Also is there a way to bypass login alert?" -- I'll reopen the issue now.

Please elaborate on what you mean by "bypass"? What are you trying to accomplish? Do you want to authenticate to Salesforce with a different OAuth flow, e.g. username-password flow (which is not recommended)? Or are you trying to have Swiftly Salesforce not display the login form when the user's session has expired and your app makes a call to Salesforce?

@mike4aday mike4aday reopened this Dec 5, 2023
@chaitba2
Copy link
Author

chaitba2 commented Dec 5, 2023

I want to skip the alert and go directly to the login page. Attached the screenshot of alert.
I tried the following to skip the alert,

in WebAuthenticationSession class, changed the below line from false to true
session.prefersEphemeralWebBrowserSession = true

and to display login again using the following code with delay

DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
    Task {
        await login()
     }
})

Please correct me if am wrong.

Simulator Screenshot - iPad Pro (12 9-inch) (6th generation) (16GB) - 2023-12-05 at 10 03 05

@mike4aday
Copy link
Owner

@chaitba2 personally I don't like to rely on the delay and I find it hard to 'reason' about what else is going on during that delay. Does it work for you? Why do you not want the alert to display? IMO the alert is common in iOS apps so users aren't put off by it and the code is cleaner.

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

No branches or pull requests

2 participants