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

Salesforce login Page is not showing up #82

Closed
degreecloud opened this issue Jul 23, 2018 · 15 comments
Closed

Salesforce login Page is not showing up #82

degreecloud opened this issue Jul 23, 2018 · 15 comments
Assignees
Labels

Comments

@degreecloud
Copy link

I have added swiftly salesforce through cocoa pods and successfully configured app delegate file but instead of opening salesforce login page on safari, app shows my rootViewcontroller. Please suggest what i should try?

@mike4aday
Copy link
Owner

@degreecloud have you tried calling any method that makes a request to Salesforce, that is, any method in the Salesforce class? When you call a method that requires authentication, Swiftly Salesforce will first attempt to use an already-stored access token. If that fails, it will attempt to refresh the access token, and if that fails, e.g. on first use when there isn't yet a stored access or refresh token, then Swiftly Salesforce will display the Salesforce-hosted login form via SFAuthenticationSession (documentation here).

@mike4aday mike4aday self-assigned this Jul 24, 2018
@degreecloud
Copy link
Author

No. I am not calling any method of salesforce. I created a new project with pod installation of swiftly salesforce and configure app delegate and info.plist as per steps given in document but not getting that login screen.

@mike4aday
Copy link
Owner

@degreecloud it's working as designed. Some apps don't require immediate login and display of the login form. If you do want to display the login form right away on app launch, then you could call the following in your app delegate, for example, and just ignore the result:

salesforce.identity()

@mike4aday
Copy link
Owner

@degreecloud BTW there is no longer (as of version 7) any configuration required in the info.plist file. Please see the current README.

@degreecloud
Copy link
Author

Thank you so much . It works!

@degreecloud
Copy link
Author

degreecloud commented Jul 31, 2018 via email

@mike4aday
Copy link
Owner

mike4aday commented Jul 31, 2018

@degreecloud there are a couple ways - at least - to do this:

  1. The user can change from production to sandbox login on the Salesforce-hosted login web form. When the login form appears, click on Forgot Your Password? and then Sandbox Login -- that will take the user to the sandbox login at test.salesforce.com

OR

  1. Set the authorizationHost parameter to test.salesforce.com in the initializer for Salesforce.Configuration (see init method), and pass that configuration to the Salesforce initializer (see init method)

@ghost
Copy link

ghost commented Jul 31, 2018

Users can log into the sandbox at https://test.salesforce.com by appending .sandbox_name to their Salesforce usernames. For example, if a username for a production organization is user1@acme.com, and the sandbox is named “test”, then the modified username to log into the sandbox is user1@acme.com.test.

@degreecloud
Copy link
Author

degreecloud commented Aug 1, 2018

@pbrondum , I am assuming customer do not know about production url and sandbox url then how he can set urls ?
Therefore i want a button like standard salesforce sdk shows on navigation bar. I want user can switch in any production and sandbox.
@mike4aday , I tested your answer for forgot password. As i click on forgot password then sandbox , sandbox url is open that's work fine but now if i want to click forgot password again then i am stuck. Button is not working. Please do check and then answer.
And your second option i tried already but we want this fetaure dynamic at runtime. Again and again we can not change code. since we want both sandbox and production in login web form.

@mike4aday
Copy link
Owner

@degreecloud - the 1st suggestion, having the user click through "Forgot Password" on the login form is not very intuitive. (How does the user know that clicking "Forgot Password" will lead to an option to change the login server? And the user can't go back, as you noted.)

But it's a Salesforce-hosted form, outside of my control. It's displayed as part of the OAuth2 'user-agent' flow, which is the prescribed way to authenticate users so your app doesn't handle credentials. I suggest this option for changing to sandbox login only because it's the easiest for the developer - no code required.

You could use my 2nd suggestion, however, dynamically at runtime. Build the Salesforce.Configuration instance at run-time and set it as the configuration property of a new Salesforce instance.

@mike4aday
Copy link
Owner

mike4aday commented Aug 6, 2018

@degreecloud - on re-reading your comment, I noted the significance of "...We want both sandbox and production in login web form..." Unfortunately, I can't provide that. The webform is hosted by Salesforce, and launched by Apple's new SFAuthenticationSession. As far as I know, there is no way to insert extra buttons or links in the web form at runtime.

@degreecloud
Copy link
Author

degreecloud commented Aug 7, 2018 via email

@degreecloud
Copy link
Author

degreecloud commented Aug 22, 2018 via email

@mike4aday
Copy link
Owner

@degreecloud sorry, I don't understand. Would you rephrase and/or include relevant code sample?

@degreecloud
Copy link
Author

degreecloud commented Sep 10, 2018 via email

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