-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Besides other documentation changes, this commit ensures the generated HTML doc for HexDocs.pm will become the source of truth for this Elixir library and leverage on latest features of ExDoc.
- Loading branch information
Showing
9 changed files
with
162 additions
and
95 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Used by "mix format" | ||
[ | ||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] | ||
] |
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
File renamed without changes.
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 |
---|---|---|
@@ -1,20 +1,29 @@ | ||
# Überauth GitHub | ||
|
||
[](https://travis-ci.org/ueberauth/ueberauth_github) | ||
[](https://hex.pm/packages/ueberauth_github) | ||
[](https://hexdocs.pm/ueberauth_github/) | ||
[](https://hex.pm/packages/ueberauth_github) | ||
[](https://github.com/ueberauth/ueberauth_github/blob/master/LICENSE.md) | ||
[](https://github.com/ueberauth/ueberauth_github/commits/master) | ||
|
||
> GitHub OAuth2 strategy for Überauth. | ||
## Installation | ||
|
||
1. Setup your application at [GitHub Developer](https://developer.github.com). | ||
1. Setup your application at [GitHub Developer](https://developer.github.com). | ||
|
||
1. Add `:ueberauth_github` to your list of dependencies in `mix.exs`: | ||
2. Add `:ueberauth_github` to your list of dependencies in `mix.exs`: | ||
|
||
```elixir | ||
def deps do | ||
[{:ueberauth_github, "~> 0.7"}] | ||
[ | ||
{:ueberauth_github, "~> 0.7"} | ||
] | ||
end | ||
``` | ||
|
||
1. Add GitHub to your Überauth configuration: | ||
3. Add GitHub to your Überauth configuration: | ||
|
||
```elixir | ||
config :ueberauth, Ueberauth, | ||
|
@@ -23,7 +32,7 @@ | |
] | ||
``` | ||
|
||
1. Update your provider configuration: | ||
4. Update your provider configuration: | ||
|
||
```elixir | ||
config :ueberauth, Ueberauth.Strategy.Github.OAuth, | ||
|
@@ -39,21 +48,20 @@ | |
client_secret: {:system, "GITHUB_CLIENT_SECRET"} | ||
``` | ||
|
||
1. Include the Überauth plug in your router: | ||
5. Include the Überauth plug in your router: | ||
|
||
```elixir | ||
defmodule MyApp.Router do | ||
use MyApp.Web, :router | ||
|
||
|
||
pipeline :browser do | ||
plug Ueberauth | ||
... | ||
end | ||
end | ||
``` | ||
|
||
1. Create the request and callback routes if you haven't already: | ||
6. Create the request and callback routes if you haven't already: | ||
```elixir | ||
scope "/auth", MyApp do | ||
|
@@ -64,7 +72,8 @@ | |
end | ||
``` | ||
1. Your controller needs to implement callbacks to deal with `Ueberauth.Auth` and `Ueberauth.Failure` responses. | ||
7. Your controller needs to implement callbacks to deal with `Ueberauth.Auth` | ||
and `Ueberauth.Failure` responses. | ||
For an example implementation see the [Überauth Example](https://github.com/ueberauth/ueberauth_example) application. | ||
|
@@ -78,7 +87,13 @@ Or with options: | |
/auth/github?scope=user,public_repo | ||
By default the requested scope is "user,public\_repo". This provides both read and write access to the GitHub user profile details and public repos. For a read-only scope, either use "user:email" or an empty scope "". See more at [GitHub's OAuth Documentation](https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/about-scopes-for-oauth-apps/). Scope can be configured either explicitly as a `scope` query value on the request path or in your configuration: | ||
By default the requested scope is "user,public\_repo". This provides both read | ||
and write access to the GitHub user profile details and public repos. For a | ||
read-only scope, either use "user:email" or an empty scope "". See more at | ||
[GitHub's OAuth Documentation](https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/about-scopes-for-oauth-apps/). | ||
|
||
Scope can be configured either explicitly as a `scope` query value on the | ||
request path or in your configuration: | ||
|
||
```elixir | ||
config :ueberauth, Ueberauth, | ||
|
@@ -87,12 +102,15 @@ config :ueberauth, Ueberauth, | |
] | ||
``` | ||
|
||
It is also possible to disable the sending of the `redirect_uri` to GitHub. This is particularly useful | ||
when your production application sits behind a proxy that handles SSL connections. In this case, | ||
the `redirect_uri` sent by `Ueberauth` will start with `http` instead of `https`, and if you configured | ||
your GitHub OAuth application's callback URL to use HTTPS, GitHub will throw an `uri_missmatch` error. | ||
It is also possible to disable the sending of the `redirect_uri` to GitHub. | ||
This is particularly useful when your production application sits behind a | ||
proxy that handles SSL connections. In this case, the `redirect_uri` sent by | ||
`Ueberauth` will start with `http` instead of `https`, and if you configured | ||
your GitHub OAuth application's callback URL to use HTTPS, GitHub will throw an | ||
`uri_missmatch` error. | ||
|
||
To prevent `Ueberauth` from sending the `redirect_uri`, you should add the following to your configuration: | ||
To prevent `Ueberauth` from sending the `redirect_uri`, you should add the | ||
following to your configuration: | ||
|
||
```elixir | ||
config :ueberauth, Ueberauth, | ||
|
@@ -102,7 +120,11 @@ config :ueberauth, Ueberauth, | |
``` | ||
|
||
## Private Emails | ||
Github now allows you to keep your email address private. If you don't mind that you won't know a users email address you can specify `allow_private_emails`. This will set the users email as `[email protected]`. | ||
|
||
GitHub now allows you to keep your email address private. If you don't mind | ||
that you won't know a users email address you can specify | ||
`allow_private_emails`. This will set the users email as | ||
`[email protected]`. | ||
|
||
```elixir | ||
config :ueberauth, Ueberauth, | ||
|
@@ -111,6 +133,8 @@ config :ueberauth, Ueberauth, | |
] | ||
``` | ||
|
||
## License | ||
## Copyright and License | ||
|
||
Copyright (c) 2015 Daniel Neighman | ||
|
||
Please see [LICENSE](https://github.com/ueberauth/ueberauth_github/blob/master/LICENSE) for licensing details. | ||
This library is released under the MIT License. See the [LICENSE.md](./LICENSE.md) file |
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
Oops, something went wrong.