alchemyguy/YoutubeLaravelApi

Auth URL param code is missing in getLoginUrl return string.

shrestha23roshan opened this issue · 1 comments

$authUrl = $authObject->getLoginUrl('email','identifier'); 
$code = Input::get('code');

code param in "$authUrl" is missing. Need Help!

@shrestha23roshan no it is not missing, you are using the code in incorrect place.
Step 1 - generate auth URL

$authObject  = new AuthenticateService;

# Replace the identifier with a unqiue identifier for account or channel
$authUrl = $authObject->getLoginUrl('email','identifier'); 

Step 2- User visits the above-generated auth-URL and gives access, then auth code is generated and redirected to the redirect_url that you add to your .env file when you create credentials
then in that rediected-url you will get code & state as URL Parameter.
then you can do,

    $code = Input::get('code');
    $identifier = Input::get('state');