forked from omniauth/omniauth
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'omniauth/oauth' | ||
require 'multi_json' | ||
|
||
module OmniAuth | ||
module Strategies | ||
# | ||
# Authenticate to Bitly utilizing OAuth 2.0 and retrieve | ||
# basic user information. | ||
# | ||
# @example Basic Usage | ||
# use OmniAuth::Strategies::Bitly, 'API Key', 'Secret Key' | ||
class Bitly < OAuth2 | ||
# @param [Rack Application] app standard middleware application parameter | ||
# @param [String] api_key the application id as [registered on Bitly](http://bit.ly/a/account) | ||
# @param [String] secret_key the application secret as [registered on Bitly](http://bit.ly/a/account) | ||
def initialize(app, api_key = nil, secret_key = nil, options = {}, &block) | ||
client_options = { | ||
:site => 'https://bit.ly', | ||
:authorize_url => 'https://bit.ly/oauth/authorize', | ||
:access_token_url => 'https://api-ssl.bit.ly/oauth/access_token' | ||
} | ||
|
||
super(app, :bitly, api_key, secret_key, client_options, options, &block) | ||
end | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') | ||
|
||
describe OmniAuth::Strategies::Bitly do | ||
it_should_behave_like "an oauth2 strategy" | ||
end |