We are trying to set up a Connected App for our Portal users

The issue is currently that the app passes the users to the login screen for the community or the portal they can log in, but it doesn’t return them to the site they originally wanted to login into, it just leaves them in the community/portal. However if we use the same app with a platform license pointed at the sandbox login, the same app works perfectly.

Salesforce have tested: the Authentication with a Connected App. I have followed the below doc for testing the webserver flow :


Making an authentication request at the authentication server.

Hitting the URL generated in the response, entered credentials of test user and then clicking on "Allow" button afterwards.

The authorization code is generated which is used to fetch access and refresh token using which I could successfully query the data.

This implies that the connected app is working absolutely fine and the issue is not at Salesforce end, therefore I would request you to check the configuration at third party end as to why the initial session is not setting up.

Detail from our Developer creating the Connected App:

The URL that we are currently building to trigger the process is…


Obviously the “state” value doesn’t really matter, and changes each time, as this is our way of ensuring the integrity of the request.

Clicking this link takes us to the following login page…


  • 1
    Is that url also configured as Start URL in the connected app in both orgs ? Commented Apr 28, 2016 at 10:55

1 Answer 1


I never know whether to post as a comment or answer... let's see.

This issue reminded me of something I saw on the G+ boards, and a solution was posted there

OK I got to the bottom of my issue. The existing custom login page had > a 'return Site.login(username, password, null);' in the login method. This meant the startURL (3rd param) was hard coded as null. I replaced with

String startURL = System.currentPageReference().getParameters().get('startURL'); return Site.login(username, password, startURL);

and now it runs through perfectly. I hope this helps!

Here's the original post.

  • Thanks Todd - I have sent this onto Salesforce Support who are looking into this issue for us. Commented May 5, 2016 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .