当前位置: 首页 > wzjs >正文

iis7网站建设上海广告公司排名

iis7网站建设,上海广告公司排名,表单大师 做网站,公司做网站的费用属于什么费用1.获取 authorizationCode: 2.利用 authorizationCode 获取 accessToken:文档中心 3.获取手机:文档中心 4.获取昵称头像:文档中心 首先创建 request 若要获取手机号,scope必填 phone,permissions 必填 …

1.获取 authorizationCode:

2.利用 authorizationCode 获取 accessToken:文档中心

3.获取手机:文档中心

4.获取昵称头像:文档中心

首先创建 request

若要获取手机号,scope必填 phone,permissions 必填 serviceauthcode,否则第 3 步将无法返回预期的字段,第 3 步与第 4 步调用接口一致,报文返回结果根据 scope 进行返回

// 创建授权请求,并设置参数
const authRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest();
authRequest.scopes = ['phone']; // 元服务不支持profile,需传其他支持的scope。默认返回UnionID、OpenID
authRequest.permissions = ['serviceauthcode']; 
authRequest.forceAuthorization = true;
authRequest.state = util.generateRandomUUID(); // 建议使用generateRandomUUID生成state
authRequest.idTokenSignAlgorithm = authentication.IdTokenSignAlgorithm.PS256;

 若要获取昵称,头像,scope必填 phone,permissions 必填 serviceauthcode。

// 创建授权请求,并设置参数
const authRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest();
authRequest.scopes = ['profile']; // 元服务不支持profile,需传其他支持的scope。默认返回UnionID、OpenID
authRequest.permissions = ['serviceauthcode']; 
authRequest.forceAuthorization = true;
authRequest.state = util.generateRandomUUID(); // 建议使用generateRandomUUID生成state
authRequest.idTokenSignAlgorithm = authentication.IdTokenSignAlgorithm.PS256;

根据接口调用返回的 authorizationCode,去调用 RESET公共API:

https://account.cloud.huawei.com/rest.php?nsp_svc=GOpen.User.getInfo

接口文档: 文档中心

// 执行授权请求,并处理结果
try {const controller = new authentication.AuthenticationController(getContext(this));controller.executeRequest(authRequest, (error: BusinessError<Object>, data) => {if (error) {this.dealAllError(error);return;}const authorizationWithHuaweiIDResponse = data as authentication.AuthorizationWithHuaweiIDResponse;const state = authorizationWithHuaweiIDResponse.state;if (state && authRequest.state !== state) {hilog.error(0x0000, 'testTag', `Failed to authorize. The state is different, response state: ${state}`);return;}hilog.info(0x0000, 'testTag', 'Succeeded in authentication.');const authorizationWithHuaweiIDCredential = authorizationWithHuaweiIDResponse.data!;const avatarUri = authorizationWithHuaweiIDCredential.avatarUri; // 元服务不支持该字段const nickName = authorizationWithHuaweiIDCredential.nickName; // 元服务不支持该字段const idToken = authorizationWithHuaweiIDCredential.idToken;const openID = authorizationWithHuaweiIDCredential.openID;const unionID = authorizationWithHuaweiIDCredential.unionID;const code = authorizationWithHuaweiIDCredential.authorizationCode;// 开发者处理avatarUri, nickName, idToken, openID, unionID, code});
} catch (error) {this.dealAllError(error);
}// 错误处理
dealAllError(error: BusinessError<Object>): void {hilog.error(0x0000, 'testTag', `Failed to auth. Code: ${error.code}, message: ${error.message}`);
}

接口即可正常返回预期报文。

http://www.dtcms.com/wzjs/475408.html

相关文章:

  • wordpress家居主题seo诊断工具有哪些
  • 网站建设合作协议模板微信软文范例大全100
  • 婚介网站建设青岛网站建设公司
  • cad协同设计平台网站seo诊断技巧
  • 企业宣传网站设计论文厦门seo代运营
  • 如何用cms做网站石家庄最新消息今天
  • 一流的嘉兴网站建设网站优化排名软件网站
  • 专做polo衫的网站北京网站seo
  • cnzz 网站域名怎么填百度云搜索资源入口
  • ps软件下载电脑版免费怎么下载搜索引擎优化指的是
  • 做动态网站怎样配置iis广告联盟自动挂机赚钱
  • 女性网站流量排名网站备案查询工信部
  • 网站建设与数据库管理推广竞价的公司有哪些
  • 创建网站的步骤是seo是什么意思广东话
  • 哪些网站可以接任务做兼职元搜索引擎有哪些
  • 网站测试速度很慢独立站seo搜索优化
  • 企业网站备案 过户网络营销项目策划方案
  • 贵州企业品牌网站建设网络营销方案的范文
  • 有没有做底单的网站营销网站大全
  • 域名备案查询网站备案信息查询免费推广的网站有哪些
  • 怎样分析一个网站做的好坏安卓优化大师app
  • 个人可以采集视频做网站吗企业官网搭建
  • 镇江网站建设远航科技企业管理培训
  • 湖北省建设厅网站首页做网站价格
  • 新乡宣传片制作公司口碑优化
  • 做网站设计的都转行干啥了专业网站快速
  • wordpress国人主题seo云优化公司
  • 国际交流合作网站建设方案seo综合排名优化
  • 网站开发服务费计入哪项费用网络平台运营是做什么的
  • 网站开发实训小结百度小说排行榜2021