Ueberauth Wordpress
Wordpress OAuth2 strategy for Überauth.
Installation
If available in Hex, the package can be installed
by adding ueberauth_wordpress
to your list of dependencies in mix.exs
:
def deps do
[
{:ueberauth_wordpress, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ueberauth_wordpress.
The code is mostly lifted from similiar OAuth2 strategies for Überauth on github, and tailored for wordpress. You need to get your client_id
and client_secret
from: wordpress
Then config your application with:
config :ueberauth, Ueberauth,
providers: [
wordpress: {Ueberauth.Strategy.Wordpress, [default_scope: "auth"]}
]
config :ueberauth, Ueberauth.Strategy.Wordpress.OAuth,
client_id: System.get_env("WORDPRESS_CLIENT_ID"),
client_secret: System.get_env("WORDPRESS_CLIENT_SECRET")
Calling
Depending on the configured url you can initiate the request through:
/auth/wordpress?state=RANDOMSTRING
Please note wordpress demands a state parameter. The strategy right now does not make use of it or check it, nevertheless, you need to pass something in.
Another thing specific to wordpress is that it cannot have redirect_uri
pre-configured, and has to take a value from the parameter. You need to make sure your app has its url configured correctly with the public facing URL.
License
This software is released under the MIT license. Please refer to the LICENSE file for detail.