Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thomasedgesmith/ueberauth_pagerduty
Ueberauth for PagerDuty OAuth
https://github.com/thomasedgesmith/ueberauth_pagerduty
Last synced: about 1 month ago
JSON representation
Ueberauth for PagerDuty OAuth
- Host: GitHub
- URL: https://github.com/thomasedgesmith/ueberauth_pagerduty
- Owner: thomasedgesmith
- License: mit
- Created: 2023-12-24T21:19:52.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-06-16T15:16:02.000Z (5 months ago)
- Last Synced: 2024-09-23T08:12:23.239Z (about 2 months ago)
- Language: Elixir
- Homepage: https://hexdocs.pm/ueberauth_pagerduty
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Überauth PagerDuty
> PagerDuty OAuth2 strategy for Überauth.
## Installation
1. Setup your application at [PagerDuty Developer](https://developer.pagerduty.com).
2. Add `:ueberauth_pagerduty` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:ueberauth_pagerduty, "~> 0.1.1"}
]
end
```3. Add PagerDuty to your Überauth configuration:
```elixir
config :ueberauth, Ueberauth,
providers: [
pagerduty: {Ueberauth.Strategy.PagerDuty, []}
]
```4. Update your provider configuration:
```elixir
config :ueberauth, Ueberauth.Strategy.PagerDuty.OAuth,
client_id: System.get_env("PAGERDUTY_CLIENT_ID"),
client_secret: System.get_env("PAGERDUTY_CLIENT_SECRET"),
redirect_uri: System.get_env("PAGERDUTY_REDIRECT_URI")
```Or, to read the client credentials at runtime:
```elixir
config :ueberauth, Ueberauth.Strategy.PagerDuty.OAuth,
client_id: {:system, "PAGERDUTY_CLIENT_ID"},
client_secret: {:system, "PAGERDUTY_CLIENT_SECRET"},
redirect_uri: {:system, "PAGERDUTY_REDIRECT_URI"}
```5. Include the Überauth plug in your router:
```elixir
defmodule MyApp.Router do
use MyApp.Web, :routerpipeline :browser do
plug Ueberauth
...
end
end
```6. Create the request and callback routes if you haven't already:
```elixir
scope "/auth", MyApp do
pipe_through :browserget "/:provider", AuthController, :request
get "/:provider/callback", AuthController, :callback
end
```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.
## Calling
Depending on the configured url you can initiate the request through:
/auth/pagerduty
Or with options:
/auth/pagerduty?scope=write
By default the requested scope is `"write"`. This provides both read
and write access to the PagerDuty API (via classic auth).Scope can be configured either explicitly as a `scope` query value on the
request path or in your configuration:```elixir
config :ueberauth, Ueberauth,
providers: [
pagerduty: {Ueberauth.Strategy.PagerDuty, [default_scope: "write"]}
]
```## Credits
Originally a fork of the [GitHub ueberauth strategy](https://github.com/ueberauth/ueberauth_github).