阿里云本机一键登录集成

简介: 阿里云本机一键登录集成

阿里云一键登录集成

//本机号码一键登录

                @weakify(self);
                //环境检查,异步返回
                [[TXCommonHandler sharedInstance] checkEnvAvailableWithAuthType:PNSAuthTypeLoginToken
                                                                       complete:^(NSDictionary * _Nullable resultDic) {
                    @strongify(self);
                    NSLog(@"环境检查返回:%@", resultDic);
                    self.isCanUseOneKeyLogin = [PNSCodeSuccess isEqualToString:[resultDic objectForKey:@"resultCode"]];
                    DYMobileAuthEntity *mobileAuthEntity1 = [DYMobileAuthEntity mj_objectWithKeyValues:resultDic];

                    if (self.isCanUseOneKeyLogin == YES) {
                        TXCustomModel *model = [PNSBuildModelUtils buildModelWithStyle:PNSBuildModelStylePortrait
                                                                          button1Title:@"切换其他手机号"
                                                                               target1:self
                                                                             selector1:@selector(gotoSmsControllerAndShowNavBar)
                                                                          button2Title:@""
                                                                               target2:self
                                                                             selector2:@selector(gotoSmsControllerAndHiddenNavBar)];
                        [[TXCommonHandler sharedInstance] getLoginTokenWithTimeout:3.0 controller:self model:model complete:^(NSDictionary * _Nonnull resultDic) {
                            @strongify(self);
                            NSLog(@"为后面授权页拉起加个速,加速结果:%@", resultDic);
                            DYMobileAuthEntity *mobileAuthEntity = [DYMobileAuthEntity mj_objectWithKeyValues:resultDic];
                            if(mobileAuthEntity && [mobileAuthEntity isKindOfClass:[DYMobileAuthEntity class]] && !isCommonUnitEmptyString(mobileAuthEntity.resultCode) && [PNSCodeSuccess isEqualToString:mobileAuthEntity.resultCode])
                            {
                                self.model.accessToken = mobileAuthEntity.token;
                                [self excuteMemberAccountLoginByTelCommand];
                            }

                        }];
                    }
                    else if(!isCommonUnitEmptyString(mobileAuthEntity1.resultCode) && [mobileAuthEntity1.resultCode isEqualToString:@"600007"])
                    {
                        //无SIM卡
                        [BITRouter openURL:@"gb://passwordLoginViewController"];
                    }
                }];

调用后台本机号码登录获取手机号和后台token

- (void)excuteMemberAccountLoginByTelCommand
{
    @weakify(self);
    [[self.viewModel.memberAccountLoginByTelCommand execute:self.model]subscribeNext:^(id result) {
        @strongify(self);
        [[TXCommonHandler sharedInstance] cancelLoginVCAnimated:NO complete:^{
            @strongify(self);
            [self backPage];
        }];
    } error:^(NSError *error) {
        @strongify(self);
    }];
}

切换其他手机号

- (void)gotoSmsControllerAndShowNavBar {
    @weakify(self);
    [[TXCommonHandler sharedInstance] cancelLoginVCAnimated:NO complete:^{
        @strongify(self);
        [BITRouter openURL:@"gb://passwordLoginViewController"];
    }];
}


- (void)gotoSmsControllerAndHiddenNavBar {

}

集成具体参考《iOS客户端接入》。阿里云这个文档没有根据最新的SDK进行实时更新,许多导入库的细节没有写,具体参照里面的demo进行接入。虽然demo也有很多问题但是比文档更贴近实际。

阿里云本机一键登录授权页面修改

目录
相关文章
|
9天前
|
XML Java 应用服务中间件
在Web Application中集成CAS登录模块
在Web Application中集成CAS登录模块
9 0
|
19天前
|
弹性计算 Kubernetes 监控
【阿里云弹性计算】阿里云 ECS 与 Kubernetes 集成:轻松管理容器化应用
【5月更文挑战第28天】阿里云ECS与Kubernetes集成,打造强大容器管理平台,简化应用部署,实现弹性扩展和高效资源管理。通过Kubernetes声明式配置在ECS上快速部署,适用于微服务和大规模Web应用。结合监控服务确保安全与性能,未来将深化集成,满足更多业务需求,引领容器化应用管理新趋势。
116 2
|
22天前
|
存储 Prometheus 运维
【阿里云云原生专栏】云原生下的可观测性:阿里云 ARMS 与 Prometheus 集成实践
【5月更文挑战第25天】阿里云ARMS与Prometheus集成,为云原生环境的可观测性提供强大解决方案。通过集成,二者能提供全面精准的应用监控,统一管理及高效告警,助力运维人员及时应对异常。集成示例代码展示配置方式,但需注意数据准确性、监控规划等问题。这种集成将在云原生时代发挥关键作用,不断进化以优化用户体验,推动业务稳定发展。
141 0
|
24天前
|
开发工具
阿里云本机一键登录授权页面修改
阿里云本机一键登录授权页面修改
54 0
|
1月前
|
Cloud Native 关系型数据库 分布式数据库
数据库性能诊断工具DBdoctor通过阿里云PolarDB产品生态集成认证
DBdoctor(V3.1.0)成功通过阿里云PolarDB分布式版(V2.3)集成认证,展现优秀兼容性和稳定性。此工具是聚好看科技的内核级数据库性能诊断产品,运用eBPF技术诊断SQL执行,提供智能巡检、根因分析和优化建议。最新版V3.1.1增加了对PolarDB-X和OceanBase的支持,以及基于cost的索引诊断功能。PolarDB-X是阿里巴巴的高性能云原生分布式数据库,兼容MySQL生态。用户可通过提供的下载地址、在线试用链接和部署指南体验DBdoctor。
198 0
|
1月前
|
存储 JSON 前端开发
Javaweb之SpringBootWeb案例之阿里云OSS服务集成的详细解析
Javaweb之SpringBootWeb案例之阿里云OSS服务集成的详细解析
62 0
|
14天前
|
API Java 监控
SpringBoot基于OpenAPI3的接口文档管理快速集成和使用
本文主要简单介绍SpringCloud2023中进行接口文档管理,方便前后端开发和文档维护。文档管理工具基于开源的knife4j封装的openapi3。
45 3
|
2天前
|
Prometheus Cloud Native Java
springboot集成prometheus异常处理
springboot集成prometheus异常处理
8 2
|
5天前
|
移动开发 前端开发 JavaScript
|
5天前
|
网络协议 JavaScript Java