CURLE_PEER_FAILED_VERIFICATION is returned when requesting an access token. Follow New post 島田 拓弥 June 08, 2022 04:51 So far, it is created as follows. // Read the JSON structure $ json = file_get_contents ('./app/tasks/〇〇.json'); $ config = json_decode ($ json); // Decrypt the private key $ private_key = $ config-> boxAppSettings-> appAuth-> privateKey; $ passphrase = $ config-> boxAppSettings-> appAuth-> passphrase; $ key = openssl_pkey_get_private ($ private_key, $ passphrase); // Create a JWT assertion $ authenticationUrl ='https://api.box.com/oauth2/token'; $ claims = [ 'iss' => $ config-> boxAppSettings-> clientID, 'sub' => $ config-> enterpriseID, 'box_sub_type' =>'enterprise', 'aud' => $ authenticationUrl, 'jti' => base64_encode (random_bytes (64)), 'exp' => time () + 45, 'kid' => $ config-> boxAppSettings-> appAuth-> publicKeyID ];; // Configure JWT header $ assertion = JWT :: encode ($ claims, $ key,'RS512'); // Request an access token $ params = [ 'grant_type' =>'urn: ietf: params: oauth: grant-type: jwt-bearer', 'assertion' => $ assertion, 'client_id' => $ config-> boxAppSettings-> clientID, 'client_secret' => $ config-> boxAppSettings-> clientSecret ];; $ client = new Client (); $ response = $ client-> request ('POST', $ authenticationUrl, [ 'form_params' => $ params, 'verify' =>'C: \ temp \ cacert.pem' ]); I get the following error:URL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.box.com/oauth2/token If you set "'verify'=>'false'", the following error will occur. Server error: `POST https://api.box.com/oauth2/token` resulted in a` 503 Service Unavailable` response: <HTML> <HEAD> <META http-equiv = "Content-Type" content = "text / html; charset = UTF-8"> <META name = "copyright" content = (truncated ...) How can I solve it? 0
Comments
2 comments