· 8 years ago · Feb 23, 2017, 11:51 AM
1**********************************************************
2VUE JS
3*********************************************************
4
5<template>
6 <div id="app">
7 <img src="./assets/logo.png">
8 <router-view></router-view>
9 </div>
10</template>
11
12<script>
13export default {
14 name: 'app',
15 created () {
16 const postData = {
17 grant_type: 'password',
18 client_id: 2,
19 client_secret: 'kcmSa6MS5V3D74RrOsSRMHZ87ACWMWse32SkdFxb',
20 username: 'sparkandyjunior@gmail.com',
21 password: 'hello',
22 scope: ''
23 }
24 this.$http.post('http://localhost:8000/oauth/token', postData)
25 .then(response => {
26 console.log(response)
27 })
28 }
29}
30</script>
31
32<style>
33#app {
34 font-family: 'Avenir', Helvetica, Arial, sans-serif;
35 -webkit-font-smoothing: antialiased;
36 -moz-osx-font-smoothing: grayscale;
37 text-align: center;
38 color: #2c3e50;
39 margin-top: 60px;
40}
41</style>
42
43
44*************************************************************
45LARAVEL
46*************************************************************
47| | POST | oauth/token | | \Laravel\Passport\Http\Controllers\AccessTokenController@issueToken | throttle |
48
49
50 public function issueToken(ServerRequestInterface $request)
51 {
52 return $this->withErrorHandling(function () use ($request) {
53 return $this->server->respondToAccessTokenRequest($request, new Psr7Response);
54 });
55 }