0

According to the documentation it is possible to pass a login_hint to the OAuth 2 login endpoint (which is the community URL in this case) as long as the prompt is also passed, set to "login":

IMPORTANT To pass the login_hint parameter for Communities, also pass the prompt=login parameter. Together, these parameters redirect the user to the login page with the correct login hint.

However, this doesn't seem to be working for me. I have tried this with both ARC (the Advanced REST Client chrome app) and by manually constructing the OAuth 2 URL of the form:

https://the-community-host.force.com/the-community-url-path?response_type=token&
  client_id=3MVxxxxxxxxxxTheOAuthConnectedAppClientIdxxxxxxxxx&
  redirect_uri=https://the-agreed-callback/url&
  scope=api&
  [email protected]&
  prompt=login

(NB: I've also tried URL encoding the "@" in the username but this makes no difference.)

Both approaches result in the login page like:

Community Login Page no Login Hint

Note how the URL only includes ec=302 (one presumes this is indicating a 302 redirect is required to the endpoint callback) and startURL=%2Fthe-community-url-path%2Fs%2F which seems to cover where the access should eventually end up (the community home page).

Do you know how to get a standard Community login page to include the login_hint as a pre-entered username?

1
  • 1
    I've taken your advice and raised a support case. Let's see if they take it anywhere.
    – Phil W
    Nov 5, 2020 at 21:15

1 Answer 1

0

UPDATE:

The URL to use for this authentication login as part of the OAuth 2 flow is in fact one like:

https://the-community-url/services/oauth2/authorize?
  redirect_uri=https://the-agreed-callback/url&
  [email protected]&
  prompt=login

Additional query parameters, such as scope, can be included as needed (it seems this automatically includes the scopes for which the community was configured if not defined). Using this will successfully leverage the login hint, pre-populating the username.

ORIGINAL:

After discussion with Salesforce Support, it appears that the URL for community login should be explicitly including the login path segment, thus:

https://the-community-host.force.com/the-community-url-path/login?response_type=token&
  client_id=3MVxxxxxxxxxxTheOAuthConnectedAppClientIdxxxxxxxxx&
  redirect_uri=https://the-agreed-callback/url&
  scope=api&
  [email protected]&
  prompt=login

Doing this experimentally did appear to work.

You must log in to answer this question.

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