I do not understand how this OAth service provider is used:
I have a login created, where, being a login, I hope to enter there an email and password and a button to make the request.
My code is this:
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="account-box">
<div class="logo">
<img src="/tweety.png" width="80px" alt=""/>
</div>
<h3 align="center">Twitvel</h3>
<form class="form-signin" action="#">
<div class="form-group">
<input type="text" name="mail" id="mail" class="form-control" placeholder="Email" required autofocus />
</div>
<div class="form-group">
<input type="password" name="password" id="password" class="form-control" placeholder="Password" required />
</div>
<div class="btn btn-lg btn-block">
<a href="{{ url('auth/twitter') }}" class="btn btn-lg btn-info btn-block">
<strong>Autentificar con Twitter</strong>
</a>
</div>
</form>
</div>
</div>
</div>
</div>
And the route to which I make the request has this code:
Route::get('/auth/twitter', function(){
$token = Input::get( 'oauth_token' );
$verify = Input::get( 'oauth_verifier' );
// get twitter service
$tw = OAuth::consumer( 'Twitter' );
// check if code is valid
// if code is provided get user data and sign in
if ( !empty( $token ) && !empty( $verify ) ) {
// This was a callback request from twitter, get the token
$token = $tw->requestAccessToken( $token, $verify );
// Send a request with it
$result = json_decode( $tw->request( 'account/verify_credentials.json' ), true );
$message = 'Your unique Twitter user id is: ' . $result['id'] . ' and your name is ' . $result['name'];
echo $message. "<br/>";
//Var_dump
//display whole array().
dd($result);
}
And I do not understand if it is correct to put my email and password in my input, I just do not understand how to login.