|
1 | 1 | ---
|
2 |
| -title: Third-party login |
3 |
| -tx_slug: documentation_reference_qfieldcloud_sso_auth |
| 2 | +title: Authentication |
| 3 | +tx_slug: documentation_reference_qfieldcloud_auth |
4 | 4 | ---
|
5 | 5 |
|
6 |
| -# Third-party authentication |
| 6 | +# Authentication |
7 | 7 |
|
8 |
| -QFieldCloud and QField / QFieldSync clients allow authentication using regular login and password, for a user that is already registered on QFieldCloud. |
| 8 | +QFieldCloud and QField / QFieldSync clients allow authentication using regular username and password, or, if configured, **OpenID Connect** with a third-party identity provider. |
9 | 9 |
|
10 |
| -It is also possible to authenticate using a third-party identity provider (e.g. Google, [OpenID Connect](https://openid.net/developers/how-connect-works/)). |
| 10 | +## OpenID Connect authentication |
| 11 | + |
| 12 | +[OpenID Connect](https://openid.net/developers/how-connect-works/) (OIDC) is an industry standard authentication protocol on top of [OAuth2](https://oauth.net/2/) that allows to delegate authentication to an identity provider (IDP) such as Google, Microsoft, or any other OpenID Connect compliant provider. This allows users to log in to QFieldCloud using their existing accounts with these providers, without needing to create a separate account for QFieldCloud. |
| 13 | + |
| 14 | +OIDC can be used directly for signing up with QFieldCloud, or for signing in to an existing QFieldCloud account (matched via verified email address). |
11 | 15 |
|
12 | 16 | Here is a sequence diagram of how a third-party login happens in QFieldCloud (in the browser):
|
13 | 17 |
|
14 | 18 | ```mermaid
|
15 | 19 | sequenceDiagram
|
16 | 20 | autonumber
|
17 | 21 |
|
18 |
| - actor User |
| 22 | + actor User as User (Browser) |
19 | 23 | participant QFC as QFieldCloud
|
20 | 24 |
|
21 | 25 | User ->> QFC: Access login page
|
22 | 26 | QFC -->> User: Display login form with configured third-party login buttons
|
23 | 27 |
|
24 | 28 | User ->> QFC: Click third-party login button
|
25 | 29 |
|
| 30 | + QFC -->> User: Redirect to IDP for login |
26 | 31 | create participant IDP as Identity Provider
|
27 |
| - QFC ->> IDP: Redirect to IDP for login |
28 |
| - IDP -->> User: Display IDP's login form |
| 32 | + User ->> IDP: Follow redirect to IDP login page |
| 33 | + IDP -->> User: Display IDP's login page |
29 | 34 |
|
30 |
| - User ->> IDP: Log in using IDP's credentials |
31 |
| - destroy IDP |
| 35 | + User ->> IDP: Authenticate using IDP credentials |
32 | 36 |
|
33 |
| - IDP ->> QFC: Redirect back with auth details |
| 37 | + IDP -->> User: Redirect to QFieldCloud callback URL with authorization code |
| 38 | + User ->>+ QFC: Hand authorization code to QFieldCloud |
| 39 | + QFC ->> IDP: Exchange authorization code for access token and ID token |
| 40 | + IDP -->> QFC: Return access token + ID token |
| 41 | +
|
| 42 | + Note over QFC: Validate ID token signature |
| 43 | +
|
| 44 | + QFC ->> IDP: Request user profile information |
| 45 | + destroy IDP |
| 46 | + IDP -->> QFC: Return user profile information |
34 | 47 |
|
35 |
| - alt User does not already have a QFieldCloud account |
36 |
| - note over QFC: QFieldCloud account is created using IDP auth details |
| 48 | + alt If user does not already have a QFieldCloud account |
| 49 | + note over QFC: QFieldCloud account is created using IDP profile infos |
37 | 50 | end
|
38 | 51 |
|
39 |
| - QFC -->> User: User is logged in |
| 52 | + QFC -->>- User: Log user in (establish session) |
40 | 53 | ```
|
41 | 54 |
|
42 | 55 | Here is a sequence diagram of how third-party authentication happens in QField and QFieldSync:
|
|
0 commit comments