iOS - Login & Session
yuu Login
By yuu APP
To integrate yuu Login into your app:
- To integrate the yuu login process in your
UIViewController. - Launch it when you're ready to start the yuu login flow.
- It will lead your app to the yuu App to get the authorization.
- As a result, you will get a yuu's JWT and maintain a yuu member section in the SDK.
Parameters
- from (UIViewController, required): The view controller that the login web view launched.
YuuManager.shared.login(from: self) { jwt, error in
//Add your code here
}
By Token Exchange
To integrate yuu Login into your app:
- Launch it when you're ready to start the yuu login flow.
- Pass a eCom token to the SDK, then the SDK will pass it to the yuu Backend and exchange a yuu's JWT.
- As a result, you will get a yuu's JWT and maintain a yuu member section in the SDK.
Parameters
eComToken (String, required): Token provided by ecom backend for yuu backend to verify.
let ecomToken: String = <YOUR TOKEN>
YuuManager.shared.loginByToken(ecomToken){ jwt, error in
//Add your code here
}
Getting Login status
Check if a user is currently logged in, return true if the session is logged in successfully:
var isLoggedIn = YuuManager.shared.isLogined()
yuu Session
Once the user grants the yuu session, you can retrieve the JWT (access token) to authenticate and access yuu APIs. You can then use the provided SDK methods to retrieve the user's profile and point balance.
JWT (access token)
After a successful login, you can retrieve the JWT of this session:
YuuManager.shared.getJWT() { jwt, error in
//Add your code here
}
User profile
After a successful login, you can retrieve the member's profile:
YuuManager.shared.getMemberProfile() { profile, error in
//Add your code here
}
User Point Balance
After a successful login, you can retrieve the member's point balance:
YuuManager.shared.getMemberPointBalance() { profile, error in
//Add your code here
}
Update Language
Update your app's current language to SDK.
Parameters
lang (Language, required)
_en- English (Default)_zh_hant- 繁中_zh_hans- 簡中
YuuManager.shared.updateLanguage(._en)
Logout
Remove the user's section in the SDK:
YuuManager.shared.logout()