Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weixin_authorize
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
weixin_authorize
Commits
13ebb290
Commit
13ebb290
authored
Mar 22, 2014
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated README.md
parent
676c8751
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
README.md
+16
-13
No files found.
README.md
View file @
13ebb290
# WeixinAuthorize
Support using
[
Redis
](
http://redis.io
)
to store
`access_token`
## Installation
Add this line to your application's Gemfile:
...
...
@@ -27,27 +29,19 @@ Or install it yourself as:
$client
||=
WeixinAuthorize
::
Client
.
new
(
ENV
[
"APPID"
],
ENV
[
"APPSECRET"
])
```
If you use
[
Redis
](
http://redis.io
)
to store your access_token, you can also specify the
`key`
:
```
ruby
$client
||=
WeixinAuthorize
::
Client
.
new
(
ENV
[
"APPID"
],
ENV
[
"APPSECRET"
],
"your_store_key"
)
```
## Option: use [Redis](http://redis.io) to store your access_token (Recommend)
## Configure to use Redis to store your access_token (Recommend)
**If you don't use Redis, it will send a request to get a new access_token everytime!**
*
Create file in:
`config/initializers/weixin_authorize.rb`
```
ruby
require "redis"
require "redis-namespace"
require "weixin_authorize"
# don't forget change namespace
namespace = "your_
app_name_weixin:weixin_authorize"
redis = Redis.new(:host => "127.0.0.1",
:port => "6379", :db => 15)
namespace
=
"
app_name_weixin:weixin_authorize"
redis
=
Redis
.
new
(
:host
=>
"127.0.0.1"
,
:port
=>
"6379"
,
:db
=>
15
)
# Delete the current namespace keys when restart
everytime.
# cleanup keys in the current namespace when restart server
everytime.
exist_keys
=
redis
.
keys
(
"
#{
namespace
}
:*"
)
exist_keys
.
each
{
|
key
|
redis
.
del
(
key
)}
...
...
@@ -57,7 +51,16 @@ $client ||= WeixinAuthorize::Client.new(ENV["APPID"], ENV["APPSECRET"], "your_st
WeixinAuthorize
.
configure
do
|
config
|
config
.
redis
=
redis
end
```
* You can also specify the `
key
`, but it is optionly.
```
ruby
$client
||=
WeixinAuthorize
::
Client
.
new
(
ENV
[
"APPID"
],
ENV
[
"APPSECRET"
],
"your_store_key"
)
```
**Note: ** `
your_store_key
` should be unique for every account!
### 获取用户管理信息
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment