Auth0- Verify token generated from react native

31 views Asked by At

I’m trying to validate the access token I receive from my react native app in the backend using the Auth0 PHP package. But unable to proceed getting internal server error.

`use Auth0\SDK\Configuration\SdkConfiguration;
 use Auth0\SDK\Auth0;
 $auth0_domain=*************;$auth0_client_id=*************;$auth0_client_secret=*************;

function verifyAuth0(){
    global $db,$logger,$auth0_domain,$auth0_client_id,$auth0_client_secret;
    $rawData = getPostRAWData();
    $usersEmail = (isset($rawData['email']) && $rawData['email']!="")? $rawData['email'] : null;
    $token = filter_var($rawData['auth0_token'] ?? null, FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE);
    $algorithm = filter_var($rawData['algorithm'] ?? 'HS256', FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE);


    try {
       echo "Before executing sdk conf";
        $configuration = new SdkConfiguration($auth0_domain, $auth0_client_id, $auth0_client_secret);
        echo "Configuration instantiated successfully!";
    } catch (\Auth0\SDK\Exception $e) {
        echo "Exception caught: " . $e;
    }
}`

On execution it prints the "Before executing sdk conf" but new Sdk Configuration throws internal server error its not going to catch block

0

There are 0 answers