diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..9b731c1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..f163ace
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/ueberauth_twitter.iml b/.idea/ueberauth_twitter.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/ueberauth_twitter.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..dfa1436
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index b8c1bdf..e9b853e 100644
--- a/README.md
+++ b/README.md
@@ -1,38 +1,38 @@
-# Überauth Twitter
+# Überauth OpenStreetMap
-> Twitter strategy for Überauth.
+> OpenStreetMap strategy for Überauth.
_Note_: Sessions are required for this strategy.
## Installation
-1. Setup your application at [Twitter Developers](https://dev.twitter.com/).
+1. Setup your application at [OpenStreetMap Developers](https://dev.OpenStreetMap.com/).
-1. Add `:ueberauth_twitter` to your list of dependencies in `mix.exs`:
+1. Add `:ueberauth_OpenStreetMap` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
- {:ueberauth_twitter, "~> 0.3"}
+ {:ueberauth_OpenStreetMap, "~> 0.3"}
]
end
```
-1. Add Twitter to your Überauth configuration:
+1. Add OpenStreetMap to your Überauth configuration:
```elixir
config :ueberauth, Ueberauth,
providers: [
- twitter: {Ueberauth.Strategy.Twitter, []}
+ OpenStreetMap: {Ueberauth.Strategy.OpenStreetMap, []}
]
```
1. Update your provider configuration:
```elixir
- config :ueberauth, Ueberauth.Strategy.Twitter.OAuth,
- consumer_key: System.get_env("TWITTER_CONSUMER_KEY"),
- consumer_secret: System.get_env("TWITTER_CONSUMER_SECRET")
+ config :ueberauth, Ueberauth.Strategy.OpenStreetMap.OAuth,
+ consumer_key: System.get_env("OpenStreetMap_CONSUMER_KEY"),
+ consumer_secret: System.get_env("OpenStreetMap_CONSUMER_SECRET")
```
1. Include the Überauth plug in your controller:
@@ -64,16 +64,16 @@ For an example implementation see the [Überauth Example](https://github.com/ueb
Depending on the configured url you can initiate the request through:
- /auth/twitter
+ /auth/OpenStreetMap
## Development mode
-As noted when registering your application on the Twitter Developer site, you need to explicitly specify the `oauth_callback` url. While in development, this is an example url you need to enter.
+As noted when registering your application on the OpenStreetMap Developer site, you need to explicitly specify the `oauth_callback` url. While in development, this is an example url you need to enter.
Website - http://127.0.0.1
- Callback URL - http://127.0.0.1:4000/auth/twitter/callback
+ Callback URL - http://127.0.0.1:4000/auth/OpenStreetMap/callback
## License
-Please see [LICENSE](https://github.com/ueberauth/ueberauth_twitter/blob/master/LICENSE) for licensing details.
+Please see [LICENSE](https://github.com/ueberauth/ueberauth_OpenStreetMap/blob/master/LICENSE) for licensing details.
diff --git a/lib/ueberauth/strategy/twitter.ex b/lib/ueberauth/strategy/osm.ex
similarity index 63%
rename from lib/ueberauth/strategy/twitter.ex
rename to lib/ueberauth/strategy/osm.ex
index 52185f4..e4d8fe3 100644
--- a/lib/ueberauth/strategy/twitter.ex
+++ b/lib/ueberauth/strategy/osm.ex
@@ -1,6 +1,6 @@
-defmodule Ueberauth.Strategy.Twitter do
+defmodule Ueberauth.Strategy.OpenStreetMap do
@moduledoc """
- Twitter Strategy for Überauth.
+ Opestreetmap Strategy for Überauth.
"""
use Ueberauth.Strategy, uid_field: :id_str
@@ -8,25 +8,25 @@ defmodule Ueberauth.Strategy.Twitter do
alias Ueberauth.Auth.Info
alias Ueberauth.Auth.Credentials
alias Ueberauth.Auth.Extra
- alias Ueberauth.Strategy.Twitter
+ alias Ueberauth.Strategy.OpenStreetMap
@doc """
- Handles initial request for Twitter authentication.
+ Handles initial request for OpenStreetMap authentication.
"""
def handle_request!(conn) do
- token = Twitter.OAuth.request_token!([], [redirect_uri: callback_url(conn)])
+ token = OpenStreetMap.OAuth.request_token!([], [redirect_uri: callback_url(conn)])
conn
- |> put_session(:twitter_token, token)
- |> redirect!(Twitter.OAuth.authorize_url!(token))
+ |> put_session(:OpenStreetMap_token, token)
+ |> redirect!(OpenStreetMap.OAuth.authorize_url!(token))
end
@doc """
- Handles the callback from Twitter.
+ Handles the callback from OpenStreetMap.
"""
def handle_callback!(%Plug.Conn{params: %{"oauth_verifier" => oauth_verifier}} = conn) do
- token = get_session(conn, :twitter_token)
- case Twitter.OAuth.access_token(token, oauth_verifier) do
+ token = get_session(conn, :OpenStreetMap_token)
+ case OpenStreetMap.OAuth.access_token(token, oauth_verifier) do
{:ok, access_token} -> fetch_user(conn, access_token)
{:error, error} -> set_errors!(conn, [error(error.code, error.reason)])
end
@@ -40,8 +40,8 @@ defmodule Ueberauth.Strategy.Twitter do
@doc false
def handle_cleanup!(conn) do
conn
- |> put_private(:twitter_user, nil)
- |> put_session(:twitter_token, nil)
+ |> put_private(:OpenStreetMap_user, nil)
+ |> put_session(:OpenStreetMap_token, nil)
end
@doc """
@@ -53,14 +53,14 @@ defmodule Ueberauth.Strategy.Twitter do
|> option(:uid_field)
|> to_string
- conn.private.twitter_user[uid_field]
+ conn.private.OpenStreetMap_user[uid_field]
end
@doc """
- Includes the credentials from the twitter response.
+ Includes the credentials from the OpenStreetMap response.
"""
def credentials(conn) do
- {token, secret} = conn.private.twitter_token
+ {token, secret} = conn.private.OpenStreetMap_token
%Credentials{token: token, secret: secret}
end
@@ -69,7 +69,7 @@ defmodule Ueberauth.Strategy.Twitter do
Fetches the fields to populate the info section of the `Ueberauth.Auth` struct.
"""
def info(conn) do
- user = conn.private.twitter_user
+ user = conn.private.OpenStreetMap_user
%Info{
email: user["email"],
@@ -79,22 +79,22 @@ defmodule Ueberauth.Strategy.Twitter do
description: user["description"],
location: user["location"],
urls: %{
- Twitter: "https://twitter.com/#{user["screen_name"]}",
+ OpenStreetMap: "https://OpenStreetMap.com/#{user["screen_name"]}",
Website: user["url"]
}
}
end
@doc """
- Stores the raw information (including the token) obtained from the twitter callback.
+ Stores the raw information (including the token) obtained from the OpenStreetMap callback.
"""
def extra(conn) do
- {token, _secret} = get_session(conn, :twitter_token)
+ {token, _secret} = get_session(conn, :OpenStreetMap_token)
%Extra{
raw_info: %{
token: token,
- user: conn.private.twitter_user
+ user: conn.private.OpenStreetMap_user
}
}
end
@@ -102,14 +102,14 @@ defmodule Ueberauth.Strategy.Twitter do
defp fetch_user(conn, token) do
params = [{"include_entities", false}, {"skip_status", true}, {"include_email", true}]
- case Twitter.OAuth.get("/1.1/account/verify_credentials.json", params, token) do
+ case OpenStreetMap.OAuth.get("/1.1/account/verify_credentials.json", params, token) do
{:ok, %{status_code: 401, body: _, headers: _}} ->
set_errors!(conn, [error("token", "unauthorized")])
{:ok, %{status_code: status_code, body: body, headers: _}} when status_code in 200..399 ->
conn
- |> put_private(:twitter_token, token)
- |> put_private(:twitter_user, body)
+ |> put_private(:OpenStreetMap_token, token)
+ |> put_private(:OpenStreetMap_user, body)
{:ok, %{status_code: _, body: body, headers: _}} ->
error = List.first(body["errors"])
diff --git a/lib/ueberauth/strategy/twitter/internal.ex b/lib/ueberauth/strategy/twitter/internal.ex
index 0d966b7..58fa837 100644
--- a/lib/ueberauth/strategy/twitter/internal.ex
+++ b/lib/ueberauth/strategy/twitter/internal.ex
@@ -1,4 +1,4 @@
-defmodule Ueberauth.Strategy.Twitter.OAuth.Internal do
+defmodule Ueberauth.Strategy.OpenStreetMap.OAuth.Internal do
@moduledoc """
A layer to handle OAuth signing, etc.
"""
diff --git a/lib/ueberauth/strategy/twitter/oauth.ex b/lib/ueberauth/strategy/twitter/oauth.ex
index 7b3ae5b..88bdf75 100644
--- a/lib/ueberauth/strategy/twitter/oauth.ex
+++ b/lib/ueberauth/strategy/twitter/oauth.ex
@@ -1,21 +1,21 @@
-defmodule Ueberauth.Strategy.Twitter.OAuth do
+defmodule Ueberauth.Strategy.OpenStreetMap.OAuth do
@moduledoc """
- OAuth1 for Twitter.
+ OAuth1 for OpenStreetMap.
Add `consumer_key` and `consumer_secret` to your configuration:
- config :ueberauth, Ueberauth.Strategy.Twitter.OAuth,
- consumer_key: System.get_env("TWITTER_CONSUMER_KEY"),
- consumer_secret: System.get_env("TWITTER_CONSUMER_SECRET"),
- redirect_uri: System.get_env("TWITTER_REDIRECT_URI")
+ config :ueberauth, Ueberauth.Strategy.OpenStreetMap.OAuth,
+ consumer_key: System.get_env("OpenStreetMap_CONSUMER_KEY"),
+ consumer_secret: System.get_env("OpenStreetMap_CONSUMER_SECRET"),
+ redirect_uri: System.get_env("OpenStreetMap_REDIRECT_URI")
"""
- alias Ueberauth.Strategy.Twitter.OAuth.Internal
+ alias Ueberauth.Strategy.OpenStreetMap.OAuth.Internal
@defaults [access_token: "/oauth/access_token",
authorize_url: "/oauth/authorize",
request_token: "/oauth/request_token",
- site: "https://api.twitter.com"]
+ site: "https://api.OpenStreetMap.com"]
defmodule ApiError do
@moduledoc "Raised on OAuth API errors."
diff --git a/lib/ueberauth_twitter.ex b/lib/ueberauth_twitter.ex
index ed45ecd..f0276da 100644
--- a/lib/ueberauth_twitter.ex
+++ b/lib/ueberauth_twitter.ex
@@ -1,3 +1,3 @@
-defmodule UeberauthTwitter do
+defmodule UeberauthOpenStreetMap do
@moduledoc false
end
diff --git a/mix.exs b/mix.exs
index 191b1d5..ea0dfa1 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,13 +1,13 @@
-defmodule UeberauthTwitter.Mixfile do
+defmodule UeberauthOpenStreetMap.Mixfile do
use Mix.Project
@version "0.3.0"
- @url "https://github.com/ueberauth/ueberauth_twitter"
+ @url "https://github.com/ueberauth/ueberauth_OpenStreetMap"
def project do
- [app: :ueberauth_twitter,
+ [app: :ueberauth_OpenStreetMap,
version: @version,
- name: "Ueberauth Twitter Strategy",
+ name: "Ueberauth OpenStreetMap Strategy",
package: package(),
elixir: "~> 1.1",
build_embedded: Mix.env == :prod,
@@ -45,7 +45,7 @@ defmodule UeberauthTwitter.Mixfile do
end
defp description do
- "An Uberauth strategy for Twitter authentication."
+ "An Uberauth strategy for OpenStreetMap authentication."
end
defp package do
diff --git a/test/strategy/twitter/oauth_test.exs b/test/strategy/twitter/oauth_test.exs
index c646e2a..14306a4 100644
--- a/test/strategy/twitter/oauth_test.exs
+++ b/test/strategy/twitter/oauth_test.exs
@@ -1,7 +1,7 @@
-defmodule Ueberauth.Strategy.Twitter.OAuthTest do
+defmodule Ueberauth.Strategy.OpenStreetMap.OAuthTest do
use ExUnit.Case, async: true
- alias Ueberauth.Strategy.Twitter.OAuth
+ alias Ueberauth.Strategy.OpenStreetMap.OAuth
setup do
Application.put_env :ueberauth, OAuth,
@@ -18,7 +18,7 @@ defmodule Ueberauth.Strategy.Twitter.OAuthTest do
test "access_token!/2 raises an appropriate error on network failure" do
assert_raise RuntimeError, ~r/nxdomain/i, fn ->
- OAuth.access_token! {"token", "secret"}, "verifier", site: "https://bogusapi.twitter.com"
+ OAuth.access_token! {"token", "secret"}, "verifier", site: "https://bogusapi.OpenStreetMap.com"
end
end
@@ -30,7 +30,7 @@ defmodule Ueberauth.Strategy.Twitter.OAuthTest do
test "request_token!/2: raises an appropriate error on network failure" do
assert_raise RuntimeError, ~r/nxdomain/i, fn ->
- OAuth.request_token! [], site: "https://bogusapi.twitter.com", redirect_uri: "some/uri"
+ OAuth.request_token! [], site: "https://bogusapi.OpenStreetMap.com", redirect_uri: "some/uri"
end
end
end
diff --git a/test/ueber_twitter_test.exs b/test/ueber_twitter_test.exs
index 3027950..ed74b04 100644
--- a/test/ueber_twitter_test.exs
+++ b/test/ueber_twitter_test.exs
@@ -1,4 +1,4 @@
-defmodule UeberauthTwitterTest do
+defmodule UeberauthOpenStreetMapTest do
use ExUnit.Case
- doctest UeberauthTwitter
+ doctest UeberauthOpenStreetMap
end