Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into DLVR-6993-merge-u…
Browse files Browse the repository at this point in the history
…pstream
  • Loading branch information
maxp36 committed Oct 12, 2023
2 parents 5c2deee + c841f11 commit eaadd79
Show file tree
Hide file tree
Showing 13 changed files with 383 additions and 165 deletions.
4 changes: 4 additions & 0 deletions .formatter.exs
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}"]
]
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Order is important. The last matching pattern takes the most precedence.
# Default owners for everything in the repo.
* @ueberauth/developers
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Continuous Integration

on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- 'master'
jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v1

- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: '1.11'
otp-version: '22.3'

- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Run Tests
run: mix test

Linting:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v1

- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: '1.11'
otp-version: '22.3'

- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Run Formatter
run: mix format --check-formatted

- name: Run Credo
run: mix credo
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Hexpm Release

on:
release:
types: [published]

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: '1.11'
otp-version: '22.3'
- name: Restore dependencies cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Run Hex Publish
run: mix hex.publish --yes
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
26 changes: 24 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
/_build
/deps
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
ueberauth_facebook-*.tar

# Temporary files for e.g. tests.
/tmp
21 changes: 15 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
language: elixir
elixir:
- 1.6
- 1.5
- 1.4
- 1.3
otp_release:
- 20.2
- 19.3
- 18.3
matrix:
include:
- otp_release: 18.3
elixir: 1.3.2
- otp_release: 19.0
elixir: 1.3.2
sudo: false
exclude:
- elixir: 1.6
otp_release: 18.3
- elixir: 1.3
otp_release: 20.2
script:
- mix test
- mix credo
60 changes: 49 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,83 @@
# v 0.6.0
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## v0.10.0 - 2021-09-23

* Allows errors from the provider to be thrown back to the user.

## v0.9.0 - 2021-09-23

* Require at least Ueberauth 0.7 due to changed builtin CSRF protection

## v0.8.2 - 2021-07-15

* Allow OAuth options to be configured from the connection
* Set default profile image to large

## v0.8.1 - 2020-03-02

* Handle errors from fetching the access token with an invalid/expired code
* Support OAuth2 version 2.0 library
* Set OAuth2 JSON library based on Ueberauth's JSON libray

## v0.8.0 - 2019-03-09

* Add option to specify scheme for user avatar URL
* Stop sending empty params to the Facebook auth dialog

## v0.7.0 - 2017-07-18

* Support `:appsecret_proof` parameter
* Set the required `:profile_fields` to get the email back

## v0.6.0 - 2016-12-27

* Support `:display` parameter
* Use OAuth2 0.8

# v 0.5.0
## v0.5.0 - 2016-09-21

* Pin OAuth2 to 0.6 to avoid errors

# v 0.4
## v0.4.0 - 2016-07-19

* Allow `:state` param to be configured

# v 0.3.2
## v0.3.2 - 2016-02-15

* Fix support for auth_type

# v 0.3.1
## v0.3.1 - 2016-02-10

* Add support for missing Locale parameter

# v 0.3.0
## v0.3.0 - 2016-02-04

* Add support for auth_type
* Support for additional request variables

# v 0.2.1
## v0.2.1 - 2015-12-11

* Add missing `profile_fields` parameter

# v 0.2.0
## v0.2.0 - 2015-11-28

* Release to follow the Ueberauth 0.2.0 release

# v 0.1.4
## v0.1.4 - 2015-11-18

* Added oauth2 and ueberauth to applications list

# v 0.1.1
## v0.1.1 - 2015-11-16

* Fixed character encoding errors in Hex package

# v 0.1.0
## v0.1.0 - 2015-11-16

* Initial strategy
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to Ueberauth Facebook
# Contributing

## Pull Requests Welcome
1. Fork ueberauth_facebook
Expand Down
101 changes: 52 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Überauth Facebook
[![Build Status][travis-img]][travis] [![Hex Version][hex-img]][hex] [![License][license-img]][license]

[travis-img]: https://travis-ci.org/ueberauth/ueberauth_facebook.png?branch=master
[travis]: https://travis-ci.org/ueberauth/ueberauth_facebook
[hex-img]: https://img.shields.io/hexpm/v/ueberauth_facebook.svg
[hex]: https://hex.pm/packages/ueberauth_facebook
[license-img]: http://img.shields.io/badge/license-MIT-brightgreen.svg
[license]: http://opensource.org/licenses/MIT
[![Build Status](https://travis-ci.org/ueberauth/ueberauth_facebook.svg?branch=master)](https://travis-ci.org/ueberauth/ueberauth_facebook)
[![Module Version](https://img.shields.io/hexpm/v/ueberauth_facebook.svg)](https://hex.pm/packages/ueberauth_facebook)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/ueberauth_facebook/)
[![Total Download](https://img.shields.io/hexpm/dt/ueberauth_facebook.svg)](https://hex.pm/packages/ueberauth_facebook)
[![License](https://img.shields.io/hexpm/l/ueberauth_facebook.svg)](https://github.com/ueberauth/ueberauth_facebook/blob/master/LICENSE)
[![Last Updated](https://img.shields.io/github/last-commit/ueberauth/ueberauth_facebook.svg)](https://github.com/ueberauth/ueberauth_facebook/commits/master)

> Facebook OAuth2 strategy for Überauth.
Expand All @@ -16,57 +15,61 @@

1. Add `:ueberauth_facebook` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[{:ueberauth_facebook, "~> 0.6"}]
end
```
```elixir
def deps do
[
{:ueberauth_facebook, "~> 0.8"}
]
end
```

1. Add the strategy to your applications:

```elixir
def application do
[applications: [:ueberauth_facebook]]
end
```
```elixir
def application do
[
applications: [:ueberauth_facebook]
]
end
```

1. Add Facebook to your Überauth configuration:

```elixir
config :ueberauth, Ueberauth,
providers: [
facebook: {Ueberauth.Strategy.Facebook, []}
]
```
```elixir
config :ueberauth, Ueberauth,
providers: [
facebook: {Ueberauth.Strategy.Facebook, []}
]
```

1. Update your provider configuration:
1. Update your provider configuration:

```elixir
config :ueberauth, Ueberauth.Strategy.Facebook.OAuth,
client_id: System.get_env("FACEBOOK_CLIENT_ID"),
client_secret: System.get_env("FACEBOOK_CLIENT_SECRET")
```
```elixir
config :ueberauth, Ueberauth.Strategy.Facebook.OAuth,
client_id: System.get_env("FACEBOOK_CLIENT_ID"),
client_secret: System.get_env("FACEBOOK_CLIENT_SECRET")
```

1. Include the Überauth plug in your controller:
1. Include the Überauth plug in your controller:

```elixir
defmodule MyApp.AuthController do
use MyApp.Web, :controller
plug Ueberauth
...
end
```
```elixir
defmodule MyApp.AuthController do
use MyApp.Web, :controller
plug Ueberauth
...
end
```

1. Create the request and callback routes if you haven't already:
1. Create the request and callback routes if you haven't already:
```elixir
scope "/auth", MyApp do
pipe_through :browser
```elixir
scope "/auth", MyApp do
pipe_through :browser
get "/:provider", AuthController, :request
get "/:provider/callback", AuthController, :callback
end
```
get "/:provider", AuthController, :request
get "/:provider/callback", AuthController, :callback
end
```
1. Your controller needs to implement callbacks to deal with `Ueberauth.Auth` and `Ueberauth.Failure` responses.
Expand All @@ -78,7 +81,7 @@ Depending on the configured URL you can initialize the request through:
/auth/facebook
Or with options:
Or with options (`auth_type`, `scope`, `locale`, `display`):
/auth/facebook?scope=email,public_profile
Expand Down Expand Up @@ -117,8 +120,8 @@ config :ueberauth, Ueberauth,
See [Graph API Reference > User](https://developers.facebook.com/docs/graph-api/reference/user) for full list of fields.
## Copyright and License
## License
Please see [LICENSE](https://github.com/ueberauth/ueberauth_facebook/blob/master/LICENSE) for licensing details.
Copyright (c) 2015 Sean Callan
Released under the MIT License, which can be found in the repository in [LICENSE](./LICENSE).
Loading

0 comments on commit eaadd79

Please sign in to comment.