Skip to content

lsshu/laravel-wx-middleware-login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-wx-middleware-login

middleware login.

Installing

$ composer require lsshu/laravel-wx-middleware-login

Usage

$ php artisan vendor:publish --tag=wx-middleware-login-migrations
$ php artisan migrate --path=database/migrations/wx_middleware
$ php artisan vendor:publish --provider="Vinkla\Hashids\HashidsServiceProvider"

Modify the configuration file "hashids.php"

'connections' => [
  'wx_token' => [
    'salt' => env('HASHIDS_WX_TOKEN_SALT', 'HASHIDS_WX_TOKEN_SALT'),
    'length' => env('HASHIDS_WX_TOKEN_LENGTH', 40),
  ],
],

Authorization Method and Request Address

Route::get('middleware',function (){
  $callback_url = urlencode('http://localhost/middleware_callback?aa=bb');
  $snsapi_type = 'snsapi_userinfo'; // snsapi_base
  return redirect('http://server/wx-middleware-login/authorize_login?snsapi_type='.$snsapi_type.'&callback_url='.$callback_url);
});

Route::get('middleware_callback',function (Illuminate\Http\Request $request){
  $data = $request->all();
  // curl 自定义方法 httpsRequest get请求
  $result = httpsRequest('http://server/wx-middleware-login/get_user_info?wx_token='.$data['wx_token']);
  dump($result);
});

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT

About

middleware login.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages