Browse Source

Merge pull request #22420 from abpframework/Switching-users-during-OAuth-login

Add documentation for switching users during OAuth login with `prompt=select_account`
pull/22434/head
Halil İbrahim Kalkan 2 years ago
committed by GitHub
parent
commit
f62e6a8b94
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. BIN
      docs/en/images/account-pro-select-account-parameter.png
  2. BIN
      docs/en/images/account-pro-select-account.png
  3. 42
      docs/en/modules/account-pro.md

BIN
docs/en/images/account-pro-select-account-parameter.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
docs/en/images/account-pro-select-account.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

42
docs/en/modules/account-pro.md

@ -104,6 +104,48 @@ If you use `Social / External Logins`, It is automatically called for authentica
![account-pro-module-local-login-setting](../images/account-pro-module-local-login-setting.png)
### Switching users during OAuth login
If you have an OAuth/Auth Server application using the Account Pro module, you can pass the `prompt=select_account` parameter to force the user to select an account.
Example to pass `prompt=select_account` parameter in OpenIdConnect:
```csharp
.AddAbpOpenIdConnect("oidc", options =>
{
// ...
options.Events = new OpenIdConnectEvents
{
OnRedirectToIdentityProvider = redirectContext =>
{
redirectContext.ProtocolMessage.Prompt = "select_account";
return Task.CompletedTask;
}
};
// ...
});
```
![account-pro-secect-account](../images/account-pro-select-account-parameter.png)
You have three options:
- Continue: The login process will continue with the current account.
- Switch to another account: Will be redirected to the login page to log in with another account.
- Create a new account: Will be redirected to the register page to create a new account.
> The OAuth login process will continue after the user selects one of the options.
![account-pro-secect-account](../images/account-pro-select-account.png)
All available prompt parameters:
| **Parameter** | **Description** |
|------------------|-------------------------------------------------------------------------------------------------------------|
| `login` | Forces the user to re-authenticate, even if they are already logged in. |
| `consent` | Forces the user to re-consent to the requested permissions, even if they have consented before. |
| `select_account` | Forces the user to select an account, even if they are already logged in (especially relevant if multiple accounts are available). |
| `none` | Does not trigger any prompt. If the user is not logged in, or their consent is not granted, it will return an error or redirect accordingly. |
## Social / External Logins

Loading…
Cancel
Save