loadLoginWebview
loginWebview.loadLoginWebview(reachfive: AppDelegate.reachfive())
Description
Opens an insecure webview through the authorization endpoint:
-
If end-users have an active in-app SSO session, the authorization endpoint immediately redirects to the application.
-
If end-users do not have an active in-app SSO session, they are redirected to the client’s Login URL for authentication.
|
You must have configured a Login URL and enabled request orchestration tokens for your identity client. Orchestrated flows are supported from version |
| We recommend using the standard native login or standard webview login for iOS. Proceed with caution while using this particular method for user authentication. |
Examples
import UIKit
import Foundation
import IdentitySdkCore
import BrightFutures
class LoginWKWebviewController: UIViewController {
@IBOutlet var loginWebview: LoginWKWebview!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let promise = Promise<AuthToken, ReachFiveError>()
loginWebview.loadLoginWebview(reachfive: AppDelegate.reachfive(), promise: promise)
promise.future
.onSuccess(callback: goToProfile)
.onFailure( error in
let alert = AppDelegate.createAlert(title: "Login failed", message: "Error: \(error.message())")
self.present(alert, animated: true)
)
}
}
| You can find this example with its UI integration in the ReachFive sandbox. |
Customisation
To further customise the behaviour and appearance of the WKWebview, please see the ReachFive sandbox.
Response
Type: Future<AuthToken, ReachFiveError>
AuthToken
The authentication token.
idToken |
The ID token JSON Web Token (JWT) that contains the profile’s information. |
||||||||||||||||||||||||||||||||||
accessToken |
The authorization credential JSON Web Token (JWT) used to access the ReachFive API. |
||||||||||||||||||||||||||||||||||
refreshToken |
The refresh token JSON Web Token (JWT) used to obtain new access tokens once they expire. This is only available when the |
||||||||||||||||||||||||||||||||||
tokenType |
The type of token. Always equal to |
||||||||||||||||||||||||||||||||||
expiresIn |
The lifetime in seconds of the access token. If |
||||||||||||||||||||||||||||||||||
user OpenIDUser |
The user’s information contained in the ID token.
|
ReachFiveError
Based on the problem, the ReachFiveError will be:
-
RequestError(requestErrors: RequestErrors)if it’s a bad request error.error
stringThe main error message.
errorId
stringThe identifier of the error.
errorUserMsg
stringThe user-friendly error message.
This property is translated according to the user’s browser settings. Currently supported languages: - Currently supported languages
-
-
ar- العربية Arabic -
de- Deutsch German -
en- English -
es- Español Spanish -
fr- Français French -
hu- Magyar Hungarian -
it- Italiano Italian -
jp- 日本 Japanese -
ko- 한국인 Korean -
nl- Nederlands Dutch -
pt- Portuguese -
ru- Ру́сский Russian -
sk- Slovenský Slovak -
zh-CN- People’s Republic of China Simplified Chinese -
zh-Hans- Simplified Chinese -
zh-Hant- Traditional Chinese -
zh-HK- Hong Kong Traditional Chinese -
zh-MO- Macao Traditional Chinese -
zh-SG- Singapore Simplified Chinese -
zh-TW- Taiwan Traditional Chinese
-
errorMessageKey
stringThe error message key.
errorDescription
stringThe technical error message.
errorDetails FieldError[]
field
stringThe field concerned by the error.
message
stringThe message error returned for the
field.code
stringThe code error returned for the
field.-
AuthFailure(reason: String)if the authentication has failed. -
AuthCanceledif the authentication was cancelled. -
TechnicalError(reason: String)if it’s an internal server error.