Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dk4210's avatar

Get OAuth2 token for API call

Hello,

Can some one give me a hand with the best way to call an API , but I need to get an OAUTH2 token first.

Is there a package that I should use?

Currently, I'm making the call like this. I know this site doesn't need a token, but the endpoint I'm using will.

 $proxy = env('curlproxy');
        $response = Curl::to('https://jsonplaceholder.typicode.com/users/4')
        ->withProxy("$proxy" , 80)
        ->asJson()
        ->get();


       dd($response);

To get the token I have

base_uri (end point for the key)
verify
auth key
scope 
grant type

What do you guys recommend on this?

0 likes
1 reply

Please or to participate in this conversation.