Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
xugenyuan
2024-05-14 15:55:23 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
89b1d71fb1ab2a205f8a2dc356bde3d8b748f8bf
89b1d71f
1 parent
3235d408
ref |> 联调华为账号一键登录功能
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
sight_harmony/features/wdLogin/src/main/ets/utils/HuaweiAuth.ets
sight_harmony/features/wdLogin/src/main/ets/utils/HuaweiAuth.ets
View file @
89b1d71
...
...
@@ -9,7 +9,7 @@ const TAG = "HuaweiOneKeyAuth"
export default class HuaweiAuth {
// 是否开启
static enable =
fals
e
static enable =
tru
e
// 匿名手机号
private _anonymousPhone?: string
get anonymousPhone() {
...
...
@@ -86,9 +86,19 @@ export default class HuaweiAuth {
// 返回结果为 Authorization Code
oneKeyLogin() : Promise<string> {
let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
// 当用户未登录华为帐号时,是否强制拉起华为帐号登录界面
loginRequest.forceLogin = true;
// let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
// // 当用户未登录华为帐号时,是否强制拉起华为帐号登录界面
// loginRequest.forceLogin = true;
// loginRequest.state = util.generateRandomUUID();
// 创建授权请求,并设置参数
let loginRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest();
// 获取头像昵称需要传如下scope
loginRequest.scopes = ['profile', 'phone'];
// 若开发者需要进行服务端开发,则需传如下permission获取authorizationCode
loginRequest.permissions = ['serviceauthcode'];
// 用户是否需要登录授权,该值为true且用户未登录或未授权时,会拉起用户登录或授权页面
loginRequest.forceAuthorization = true;
loginRequest.state = util.generateRandomUUID();
return new Promise((resolve, fail) => {
...
...
Please
register
or
login
to post a comment