Does Okta Support a single Sign-on between Mobile and Web?

We are in the process of integrating functionality between our mobile App and our website. Our mobile App uses native SDKs for iOS and Android. Our web site uses the Okta component for login. We were able to get a single sign-on working between the iOS native login and a React.JS application, loaded in a webview, without needing the user to login again.

Steps to reproduce:

  1. Login in using the native iOS SDK.
  2. Decode the idToken and AccessToken (see the iOS code below).
  3. Load the login page into a Webview.
  4. Used the results from the native login to build the JSON structure that is found in the localStorage ‘okta-token-storage’ structure.
  5. Reload the Webview
    Questions
  6. Is this supported?
  7. Is there another way to accomplish this that is recommended?

Below is the iOS and JavaScript code we used to accomplish this.

Thanks

//iOS code
let idData = try! OktaOidcStateManager.decodeJWT(idToken);
let accessData = try! OktaOidcStateManager.decodeJWT(accessToken);
let url = idData[“iss”] as! String;
let ver = idData[“ver”] as! Int;
let verString = String(ver)
let authorizeUrl = url + “/v” + verString + “/authorize”
let userInfoUrl = url + “/v” + verString + “/userinfo”
let scopes = (_oktaConfig![“scopes”]! as! String).components(separatedBy: " ")

let aDic: [String: Any] = [
“accessToken”: accessToken,
“expiresAt”: accessData[“exp”]!,
“tokenType”: “Bearer”,
“scopes”: scopes,
“authorizeUrl”:authorizeUrl,
“userinfoUrl”: userInfoUrl
]
let idDic: [String: Any] = [
“idToken”: idToken,
“claims”: idData,
“expiresAt”: idData[“exp”]!,
“scopes”: scopes,
“authorizeUrl”: authorizeUrl,
“issuer”: self._oktaConfig![“issuer”]!,
“clientId”: self._oktaConfig![“clientId”]!
]

let oktaTokendata = [
“accessToken”: aDic,
“idToken”: idDic,
]

return oktaTokendata;

//JavaScript side

const data = JSON.stringify(oktaTokenStorage);

return window.localStorage.setItem('okta-token-storage','${data}' ); location.reload(); true;

Libraries used:

iOS:
‘OktaAuthSdk’, ‘2.1.0’
‘OktaOidc’, ‘3.5.2’

Android:
implementation ‘com.okta.android:oidc-androidx:1.0.13’
implementation ‘com.okta.authn.sdk:okta-authn-sdk-api:1.0.0’
implementation(‘com.okta.authn.sdk:okta-authn-sdk-impl:1.0.0’) {
exclude group: ‘com.okta.sdk’, module: ‘okta-sdk-httpclient’
}
implementation ‘com.okta.sdk:okta-sdk-okhttp:1.5.4’