美文网首页PHP程序员
PHP 实现oppo小游戏授权

PHP 实现oppo小游戏授权

作者: php转go | 来源:发表于2020-11-02 15:29 被阅读0次

    由小游戏端发起授权,拿到oppo的授权token,其实就是相当于微信授权的code

        private function auth($oppo_token){
            $Settings = config('app_config');
            $msectimes = floor(microtime(true)*1000);
            $set['pkgName'] = $Settings['pkgName'];
            $set['appKey'] = $Settings['appKey'];
            $set['appSecret'] = $Settings['appSecret'];
            $set['token'] = $oppo_token;
            $set['timeStamp'] = $msectimes;
            ksort($set);
            $sign = md5(http_build_query($set));
            $sign = strtoupper($sign);
            $url = "https://play.open.oppomobile.com/instant-game-open/userInfo?pkgName={$Settings['pkgName']}&timeStamp=$msectimes&token=$oppo_token&sign=$sign";
            $header = array("Content-type: application/json;charset='utf-8'", "Accept: application/json");
            $curl_get = curl_get($url, $header);
            Log::info('授权信息:'.$curl_get);
            return json_decode($curl_get, true);
        }
    

    返回数据中
    errorcode=200就是正常返回

    相关文章

      网友评论

        本文标题:PHP 实现oppo小游戏授权

        本文链接:https://www.haomeiwen.com/subject/gojmvktx.html