Skip to content

Add guide for adding Web eID for Mobile support to an existing integration - #79

Open
aarmam wants to merge 3 commits into
web-eid-mobilefrom
NFC-183
Open

aarmam wants to merge 3 commits into
web-eid-mobilefrom
NFC-183

Conversation

@aarmam

@aarmam aarmam commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Signed-off-by: Mart Aarma mart.aarma@nortal.com

@aarmam
aarmam requested a review from mrts September 22, 2026 08:18
@aarmam
aarmam force-pushed the NFC-183 branch 2 times, most recently from 1fcb89a to ac40908 Compare September 22, 2026 11:23
aarmam and others added 3 commits September 22, 2026 14:26
…ation

Add a short section to the README that lists only what an application with
a working regular Web eID integration has to change or add for the mobile
authentication flow, naming the example files that implement each step.
Digital signing is noted as not covered by the PHP library or example.

Signed-off-by: Mart Aarma <mart.aarma@nortal.com>
Co-authored-by: Sander Kondratjev <sander.kondratjev@nortal.com>
Signed-off-by: Mart Aarma <mart.aarma@nortal.com>
Co-authored-by: Sander Kondratjev <sander.kondratjev@nortal.com>
Signed-off-by: Mart Aarma <mart.aarma@nortal.com>
Co-authored-by: Sander Kondratjev <sander.kondratjev@nortal.com>
if (!isset($_SESSION["csrf-token"])) {
$_SESSION["csrf-token"] = bin2hex(random_bytes(32));
}
$this->ctx->assertCsrf();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README MobileAuth code example still contains the old if (!isset($_SESSION[ ... snippet, the example code should be updated as well.

Comment thread README.md
### Issuing challenge nonces for Web eID for Mobile

The `POST /auth/mobile/init` endpoint initiates authentication flows that use **Web eID token format v1.1**. It generates a challenge nonce and returns a deep link URI that embeds a base64-encoded payload containing the challenge nonce, the login endpoint URL and whether the mobile application should include the signing certificate information in the authentication token. The mobile application opens the deep link, signs the challenge and posts the `web-eid:1.1` authentication token to the `POST /auth/mobile/login` endpoint, which validates it with the same `AuthContext::authenticate()` method that is used in the regular flow. See the full implementation in `example/src/MobileAuth.php`.
The `POST /auth/mobile/init` endpoint initiates mobile authentication. Authentication-only responses use `web-eid:1.0`; requesting signing certificate information uses `web-eid:1.1`. It generates a challenge nonce and returns a deep link URI that embeds a base64-encoded payload containing the challenge nonce, the login endpoint URL and whether the mobile application should include the signing certificate information in the authentication token. The mobile application opens the deep link and returns the authentication token in the browser login page URL fragment. The page posts the token to `POST /auth/mobile/login`, which validates it with the same `AuthContext::authenticate()` method that is used in the regular flow. See the full implementation in `example/src/MobileAuth.php`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/validate accepts the raw authentication token directly, but mobile /auth/mobile/login expects {"authToken": ...} structure, this should perhaps be clarified?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants