Skip to main content
The sign-in device shows a QR code. The user scans it with their phone, signs in to their Google, Apple, Huawei, Yandex, VK ID or other provider account on the phone and confirms the sign-in there, and the sign-in completes on the device. No password is typed on the sign-in device at all. What sets this apart from an ordinary “Sign in with Google” button is where the credentials are entered. The button opens the provider’s sign-in in the browser of the device the user is signing in on, so the Google username and password are typed there. Here the provider’s sign-in happens on the phone, and the sign-in device receives only the result. This is a built-in Veriqa channel, the Veriqa.Core.ChannelAdapter.WebProviders package. A provider is turned on in configuration, and one client registered with a provider is one channel; the setup is in Sign-in with a provider account. You need a public HTTPS address of Veriqa and a client registered with the provider.

When it helps

A device where your users would rather not type their passwords:
  • someone else’s computer or a shared one;
  • a colleague’s workstation;
  • a computer in a hotel, a coworking space or a classroom;
  • a kiosk or a terminal at a counter.
A surface with no keyboard:
  • a TV or a set-top box, where a password would have to be typed with a remote;
  • a kiosk with a touch screen;
  • a device with a few buttons;
  • a screen in a meeting room.

How it works

  1. The sign-in device starts an ordinary OpenID Connect sign-in through /connect/authorize. The Veriqa sign-in page shows a QR code with a hop mode link.
  2. The user scans the QR code with the phone camera. The phone opens the hop page of the node; when several channels are enabled, the user picks one, Google for example.
  3. Veriqa sends the phone to the provider with the authorization code flow. The user picks an account. If they are not yet signed in to the provider on the phone, they sign in now and type the provider password on the phone.
  4. The provider returns the phone to the Veriqa return address. Veriqa validates the provider’s answer, opens the channel page on the phone and sets a cookie that binds the browser to this sign-in and this account. The page heading is the brand name the sign-in page shows (BrandName), with “via Google” under it; if no brand name is set, the heading is the channel name.
  5. The page shows the Veriqa question, the same text a chat channel receives: the application being signed in to, the browser and system the sign-in started from, the location and the time. On a phone the user answers Yes by dragging a slider to the end, or taps No. Where the slider appears is set by ConfirmSlider.
  6. Veriqa receives the answer: a confirmation or a decline.
  7. The sign-in device completes the OpenID Connect flow. What the phone shows next depends on the page that opened the channel and on the action after the sign-in:
    • The hop page. It opens the channel page in the same tab, so the phone has one tab. The channel page shows the outcome. With a welcome message, a menu or a redirect, it shows the welcome above the outcome, or the menu or the button in place of the outcome.
    • A sign-in page opened on the phone itself. It opens the channel page in a new tab and stays under it. With no action (None, the default), the channel page closes its tab by itself, and the sign-in page returns the user to the application. If the browser leaves the tab open, the channel page shows the outcome. With a welcome message, a menu or a redirect, the channel page stays open and shows them. If the sign-in is declined or expires, nothing follows it, and the tab closes as with None.
    Like a chat, the channel page adds nothing under the outcome or the action. To tell the user that the tab can be closed, add a line to the wording of this channel’s outcome receipt (the ByChannel group of Veriqa:MessageTemplates). A confirmation of an action behaves like a sign-in with None: nothing follows it.
Signing in on a computer with Google: the phone camera scans the QR code, the user picks a Google account, slides to answer Yes on the confirmation page, and sees "Sign-in confirmed".

These steps with a Google account.

The page shows only the latest message of the current sign-in. Messages from the user’s earlier sign-ins do not reappear on it, and their buttons are gone. Your application receives a sub of the form google:<the user's identifier at Google>, where google is the channel name, along with channel_user_id and channel_type. When the provider has passed an email address, email and email_verified arrive too. When the application needs an email address the provider did not give, the phone opens the claims completion form right away, with no button to tap first. Once the user sends the form, the phone returns to the channel page. If the channel link is opened in the browser of the sign-in device itself rather than scanned with a phone, the flow becomes an ordinary sign-in at the provider followed by the same question page. Nothing cross-device happens then, and nothing breaks.

Why the Yes/No step

A provider may return a result without asking anything: without prompt, Google shows a consent screen only to a user who has not authorized the application yet, so on a phone signed in to a single Google account that has authorized it, the request goes through with no screen at all. The channel setting Settings:Prompt set to select_account makes Google show at least the account chooser (Google: OpenID Connect). Choosing an account still says nothing about whose sign-in it completes. Without the question, an attacker could show a victim the QR code of the attacker’s own sign-in, and the victim’s sign-in at Google would silently complete it — on the attacker’s device, under the victim’s account. The question names the application and the device the sign-in started from, so the victim can answer No. Whether the question is asked is decided by Veriqa:LoginConfirmation:Mode and ModeByChannel, as for any channel. With ChannelDefault and InChannel the page on the phone asks. With OnWebPage the sign-in window asks, and the phone shows a message asking the user to confirm there. Once the sign-in ends, the message gives way to the outcome.
With None the sign-in completes without a question, and a QR code of someone else’s sign-in that the user scans completes that sign-in under the user’s account. Keep the question on for provider channels.
The question and the answer are bound to one sign-in:
  • the page works only in the browser that came back from the provider: the cookie set at the return address marks it;
  • in another browser the page address shows neither the details nor the buttons;
  • a second account that signs in at the provider for the same sign-in gets no question, and its answer is not accepted.
When the core withholds the details of the initiator, the page still asks, without them. What is shown about whoever started the sign-in is covered in Initiator context. A confirmation of an action goes through the same channel and the same pages. Only the text of the question differs: it names what is being confirmed.

The provider’s access token

The channel keeps no token the provider issues: no access token, ID token or refresh token. Your application receives Veriqa tokens with the claims listed above, and no setting or claim passes the provider’s access token on to it. This is deliberate, for three reasons:
  • The token would have to wait on the Veriqa server. The provider issues it when it sends the phone back to the Veriqa return address, while your application gets its tokens later, on another device, after the user answers. To pass the token on, the server would hold access to the user’s provider account for all that time.
  • Someone else’s QR code would give away more than a sign-in. Without the token, an attacker who gets a victim to complete the attacker’s sign-in receives a session in your application. With it, the attacker would also receive access to the victim’s provider account within the scopes the channel requests, such as mail or files, and a refresh token when offline access is on. This is how device code phishing works against OAuth 2.0 Device Flow. The Yes/No question lowers this risk but does not remove it: showing who started the sign-in does not protect against relay attacks.
  • One registration serves every application. The WebProvider keys of a channel are set at the core level only, so one client registered with the provider serves all applications and tenants of the deployment. The provider’s consent screen names the app registered with it, not the application that would get the token.

Device flow and token exchange in OpenIddict

OpenIddict, which Veriqa is built on, supports the OAuth 2.0 Device Authorization Grant (RFC 8628) and OAuth 2.0 Token Exchange (RFC 8693) in both its server and its client. The Veriqa server turns on neither. The device grant would give an application one more way to get Veriqa tokens and changes nothing about the provider’s token; how it relates to Veriqa is covered in Smart TV and keyboard-free surfaces. Token exchange is the standard way to give an application a token for another resource, but the provider’s token would still have to be stored, and the reasons above still apply. When your application needs the provider’s API, have it get the token from the provider directly: through an ordinary sign-in at the provider or, on a device without a keyboard, through the provider’s device flow if the provider supports it. The provider then asks the user’s consent for your application, and the token does not pass through Veriqa.

What you build yourself

If your application needs the provider’s token from this very sign-in, you can add that in your own project at your own risk: the core does not check where the token is kept or who gets it. There are two ways:
  • Your own channel based on a sample. samples/dotnet/custom-channel-id-providers and samples/dotnet/pseudo-channels (Samples in the repository) sign in at the provider with the ASP.NET Core OpenID Connect handler and set SaveTokens = false. In your copy, the provider’s answer and its tokens reach your own code.
  • A handler on the client of the built-in channel. The channel adds its OpenIddict client to the same AddOpenIddict() as the Veriqa server, and the settings you add to that client are kept; the package README lists what the channel adds. A handler of the ProcessAuthenticationContext client event, ordered after OpenIddict’s own handlers, sees at the return address the provider’s access token (BackchannelAccessToken), the refresh token when offline access is on (RefreshToken), the channel name (RegistrationId) and the user’s identifier at the provider in MergedPrincipal. Your application receives that identifier as channel_user_id, so you can look the token up by it.
Whichever way you choose, the rest is up to you:
  • give the token only to your application’s server, and only after it has received Veriqa tokens for the same channel_user_id; never put it into a claim, a page or the browser;
  • store it encrypted, delete it when it expires and keep it out of logs;
  • delete the tokens of sign-ins the user declined or never completed: the provider issues the token before the user answers;
  • keep the Yes/No question on;
  • request only the scopes your application uses.
See it live. The Nova Stream online sample offers sign-in with a Google account on its TV sign-in page: the viewer signs in to Google on the phone and confirms there.

Samples in the repository

The built-in channel is not the only way to get this sign-in. The repository (veriqa.app/source) has two samples that do the same in other ways:
  • samples/dotnet/custom-channel-id-providers — sign-in with a provider account as an external adapter in .NET, connected through the HTTP channel. It shows an adapter that runs next to Veriqa rather than inside it: Build a channel in any language.
  • samples/dotnet/pseudo-channels — an adapter in the host process, built on the public channel SPI: Build a channel in C#.

What to keep in mind

  • Scan the QR code with the system camera, not inside a messaging app. A QR code or a link opened in an app’s built-in browser reaches Google in an embedded user agent, and Google refuses the sign-in with disallowed_useragent (Google: OAuth 2.0 policies, “Use secure browsers”, Google: authorization errors).
  • A phone number only through a mapping. By default the channel takes no phone number from the provider, and the claims completion form does not ask for one. This channel is then not offered to a sign-in that requires a phone number; when the number is optional, the sign-in completes without it. To take the number from the provider, set the PhoneNumber block of the channel: Phone number and other claims from the provider.
  • Apple: the email may be a relay address. A user may choose an anonymous address that forwards to their real one; mail reaches it only from sender domains registered with Apple (Apple: private email relay service). Treat email as a contact address, not as an identifier: the identifier is sub.
  • Apple: no name. Apple returns the name in a separate user field of the authorization response rather than as an ID token claim (Apple: request an authorization), and only the first time the user signs in (Apple: authenticating users). The channel does not take that field, so the display name of an Apple user is their email address.
  • The channel name is part of sub. Renaming a channel changes the sub of every user who signed in through it. Pick the name before your users first sign in.
  • Several replicas. The state of the phone pages lives in the host process by default. With more than one replica, turn on the channel stores in Redis.

See also