When the user goes to the authorization endpoint, they will be asked to give your application permission to the scopes that you've requested. They can decline this, so you must make sure to take that into consideration in your code. After they've allowed your application access, the user will be redirected to the URL you specified in redirect_uri
. The query string will now have a code
parameter, which is the authorization code that you can exchange for an OAuth token.
<?php
$authCode = $_GET['code'];
?>