下面是后台java部分,通过App端,用户确认授权后拿到的actoken来换取电话号码

Java服务端SDK

<dependency>
		    <groupId>com.aliyun</groupId>
		    <artifactId>aliyun-java-sdk-core</artifactId>
		    <version>4.4.4</version>
		</dependency>
		<dependency>
		    <groupId>com.aliyun</groupId>
		    <artifactId>aliyun-java-sdk-dypnsapi</artifactId>
		    <version>1.0.4</version>
		</dependency>

 通过token获取电话号码

public String getPhone(String token) {
		DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", AliConfig.ACCESSKEYID, AliConfig.ACCESSKEYSECRET);//自己阿里云的配置
		IAcsClient client =new DefaultAcsClient(profile);
        GetMobileRequest request = new GetMobileRequest();
        request.setAccessToken(token);//app端传过来的,需要用户授权拿到
        request.setRegionId("cn-hangzhou");
        String phone = null;
        try {
            GetMobileResponse response = client.getAcsResponse(request);
            if("OK".equals(response.getCode())) {
            	phone = response.getGetMobileResultDTO().getMobile();
            };
            System.out.println(new Gson().toJson(response));
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            System.out.println("ErrCode:" + e.getErrCode());
            System.out.println("ErrMsg:" + e.getErrMsg());
            System.out.println("RequestId:" + e.getRequestId());
        }
		return phone;
	}

前端支持(阿里官方提供了demo的):ios,android,h5,uniapp

参考文档:https://help.aliyun.com/document_detail/117608.html?spm=a2c4g.11174283.3.6.180929d30L4Qin