skmetaly / laravel-twitch-restful-api

Laravel implementation of the restful api provided by Twitch.tv
MIT License
8 stars 4 forks source link

Issue with getting data of channel, or anything #2

Closed olszak94 closed 8 years ago

olszak94 commented 8 years ago

I'm trying this {{ TwitchApi::channel("dasmehdi") }} in my blade template file.

It throws me this error

ErrorException in RequestException.php line 89:
Client error response [url] https://api.twitch.tv/kraken/oauth2/token [status code] 400 [reason phrase] Bad Request (View: /var/www/r4f.me/html/laravel/resources/views/twitch.blade.php)

ClientException in RequestException.php line 89:
Client error response [url] https://api.twitch.tv/kraken/oauth2/token [status code] 400 [reason phrase] Bad Request
skmetaly commented 8 years ago

Ok, this is weird, i will take a look as soon as possible.

Just to rule out some things :

Did you already logged in using the API ? If you look at the Twitch RestAPI documentation ( https://github.com/justintv/Twitch-API/blob/master/v3_resources/channels.md ) you can see that for /channel it requires :

Authenticated, required scope: channel_read

Thanks for trying my component :)

olszak94 commented 8 years ago

I've used basic config file, edited only client id, secret, redirect url. I used {{ url(TwitchApi::authenticationURL()) }} to connect twitch. I may have to set the parementer of token somewhere ?

Would be nice if you could commit a simple example of how to use some of the options of twitch api.

olszak94 commented 8 years ago

Any progress towards this ?

htmlentities() expects parameter 1 to be string, array given (View: /var/www/rafdev.ovh/html/msvixen/resources/views/twitch.blade.php)

thats what i get after using

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

    if ($code !== null)
    {
        $token = TwitchApi::requestToken($code);
    } else
    {
        $token = null;
    }

    $data = TwitchApi::user('vuvuke');

    return view('twitch', ['token' => $token, 'data' => $data]);

in my controller

and below is my view

@extends('master')

@section('content')
    <h1>Twitch.TV</h1>
    {{ $token }}

    {{ $data }}
@endsection