PortalAuth method. Reads the URL locally and synchronously: it sends nothing to Portal, touches no storage, logs nothing and uses up no grant, so it is safe to call on every URL your app receives. Complete the result with the method for its case: getMagicLinkDetails and, once the user confirms the email, confirmMagicLink for a magic link; completeOAuthLogin for Google or Apple.
Parameters
url: The URL iOS delivered to your app, as aURL(fromonOpenURL, your scene delegate or your app delegate) or aString. TheURLoverload forwardsabsoluteString, so percent-encoding stays intact and the grant is decoded exactly once.
AuthRedirect?:.magicLink(AuthRedirect.MagicLink): A magic link. Pass itstokentogetMagicLinkDetails, show the user the email, and callconfirmMagicLinkonly once they confirm it..oauth(AuthRedirect.OAuth): A Google or Apple grant.provideris.googleor.apple. Pass every one tocompleteOAuthLogin: it completes only the sign-in this device started, so a grant someone else obtained, opened through your redirect URL by a web page, message or app, signs nobody in..failed(error:): The sign-in did not complete — the user cancelled, the provider rejected it, or it failed for any other reason — so Portal redirected with an error in the URL (error=oauth_failed) instead of a grant. Nothing was sent to Portal. The value is bounded to 100 characters, but it comes from an inbound URL that any app or website can open, so show your own text rather than the raw value.nil: The URL is not a Client Auth redirect for this instance. Let your other URL handlers try. Returned when the URL:- is empty or longer than 8192 UTF-16 code units (checked before it is parsed),
- does not target this instance’s
redirectUrl(scheme and host compared case-insensitively, the path case-sensitively, ignoring trailing slashes and surrounding whitespace), - carries both
authMethodandlogin_type(Portal never sends both), or - carries no
errorparameter and either notoken(or an empty or whitespace-only one) or no sign-in marker this SDK recognizes.
.failed(error:).
Types
- Only
parseRedirectcan build a.magicLinkor.oauthvalue; their initializers are not public. - Printing an
AuthRedirect(description,debugDescription,dump) shows<redacted>in place of the token.EquatableandHashablestill compare the real token, so two values for the same link are equal.MagicLink.tokenread on its own is a plainString, so keep theMagicLinkvalue rather than the bare token, and never log or persist it. - Unless it carries both
authMethodandlogin_type, a redirect that carries?error=…is.failed(error:), even when it also carries a token or a sign-in marker, and its token is never handed out. - Magic-link redirects carry
authMethod=EMAIL_MAGIC_LINK; Google and Apple redirects carrylogin_type=GOOGLEorlogin_type=APPLE. Both are matched exactly. See What Portal appends. - If your redirect URL already carries a
tokenparameter, the last occurrence is read, which is always the one Portal appended. - Never log the raw URL; it contains the grant.
- Available starting from SDK version 8.2.0.