Skip to content

Instantly share code, notes, and snippets.

@Martin91
Martin91 / weibo_oauth2.rb
Last active August 29, 2015 14:04
methods pair to finish OAuth2 flow on weibo.com
# Attention: the below methods are actions extracted from my controllers in a Rails App, if you need to use these codes outside
# a Rails project, rememeber to replace some Rails-specified methods, such as, Hash#to_param.
# STEP 1: start to request an authorization
def request_authorize
session[:security_state] = 'I am from Martin site'
authorize_url = "https://api.weibo.com/oauth2/authorize"
params = {
client_id: "663911642", # Required: Your assigned App Key