Commit Graph

26 Commits

Author SHA1 Message Date
Andrew Darqui
64b65ca4c6
Properly handle empty credsExtra fields
Marks "location" as Maybe in GitHub responses. Without this, users could
experience an InvalidProfileResponse error when missing.

Also fixes cases where fields were Maybe, but the (.:?) combinator was
not being used in the parser.
2016-06-24 11:41:08 -04:00
silky
7354c36e13
Nicer error message when 'code' field missing
Fixes #42
2015-12-07 14:06:58 -05:00
patrick brisbin
ad561a09d6
Append the state query parameter correctly
If the endpoint URL doesn't yet have any query parameters, this code
would construct an invalid URL by appending `&state=` rather than
`?state=`. We now correctly append `?state=` or `&state=` depending on
the URL already containing a `?` character.

Fixes #44

This is a "good enough" solution for the moment, done for ease of
implementation and speed of delivery. An eventual better solution would
be to use a URL-parsing and constructing library to parse the existing
endpoint, append parameter tuples, and re-construct a new URL.

Restructuring the data types so we start handling real URL and
QueryParam values instead of ByteStrings would also be an option, though
we're a little cornered by the Yesod.Auth.OAuth interface.
2015-11-28 11:42:05 -05:00
patrick brisbin
a3d8a6cdd5
Add/fix documentation, change argument order
- Document the difference between widget and non-widget functions
- Pass the widget as the first argument to take advantage of partial
  application
2015-06-29 10:42:11 -04:00
Stefan Dresselhaus
ce98f1ba4e got rid of maybe 2015-06-28 18:16:02 +02:00
Stefan Dresselhaus
77db081d6c changed image-display to widget-display 2015-06-28 18:00:18 +02:00
Stefan Dresselhaus
b9d9b51a6c Added EVE-Online SSO and made it possible for plugins to use images instead of text-links to login 2015-06-28 00:22:14 +02:00
patrick brisbin
2d3d1d2a8e
Add fromProfileResponse
Handles the common case of fetching profile information from a single
JSON endpoint. Throws InvalidProfileResponse if JSON parsing fails.
2015-04-13 17:09:06 -04:00
patrick brisbin
ad0e354b2b
Support GHC 7.10
- Conditionally import Control.Applicative
- Enable FlexibleContexts
2015-04-07 12:56:43 -04:00
patrick brisbin
0b0e6c179d
Use consistent style throughout project
- Alphabetize imports
- Place qualified imports separate and last
- BL for ByteString.Lazy
- Don't align tokens in tuple lists or record assignments
- Two-space indent for where keyword
- Use record syntax for Creds
- Break before operators in Applicative expressions
- Consistent whitespace throughout

Resolves #19
2015-03-25 16:30:15 -04:00
patrick brisbin
029122f662
Learn rebranded as Upcase 2015-03-24 17:56:59 -04:00
patrick brisbin
270d1b2eec
Formatting 2015-03-24 17:50:24 -04:00
jprider63
bc320b1397
Move state token handling generic oauth2Plugin
Resolves #23
2015-03-24 17:26:35 -04:00
patrick brisbin
a2647e0ada
Reformat data declaration and comment
- Prevents haddock parse error
2014-08-19 17:33:33 -04:00
Kayo Phoenix
d9a41130b0 Version upgrade (hoauth2 0.4.1). 2014-08-13 11:02:46 +06:00
Max Cantor (MBPr)
267bef2c9a relaxed bounds for ghc 781 2014-04-09 16:59:39 -07:00
patrick brisbin
4354dc630a Replace call to error with throwIO. Fixes #2
* error would crash the server
* IO exception should result in a 500
2014-02-21 12:25:31 -05:00
patrick brisbin
257968f067 Fix documentation error 2014-02-21 11:00:57 -05:00
patrick brisbin
4b6cb31ba9 Typos 2014-02-15 16:05:59 -05:00
patrick brisbin
7536e7f25f Refactor to separate modules, document things
* oauth2 functions now handle the getCreds argument themselves
* Learn is updated to do the Right Thing
* Google is unfinished
2014-02-15 15:56:15 -05:00
patrick brisbin
1ea281b4b1 Minor refactor 2014-02-15 15:23:58 -05:00
patrick brisbin
4ec390e32a Use Network.OAuth.OAuth2
* Provides basically the same interface
* Re-export it for making additional requests
2014-02-15 15:11:03 -05:00
patrick brisbin
434e2bc092 Update dependencies, make it work, address -Wall
Housekeeping:

* Use newer http-conduit (Request m becomes Request)
* Increase upper bound on aeson
* Fix whitespace, remove unfinished function
* Add type signatures and some comments
* Remove unused imports

Fixes:

* ByteString needs an orphan JSON instance so AccessToken can have one.
  I'm not sure if there's a way around this.
* redirect takes a Text, not a ByteString
* dispatch for "callback" should handle setting the credentials

Additions

* oauth2Learn for authenticating against learn.thoughtbot.com
2014-02-15 14:44:01 -05:00
Tom Streller
6d3bd0f281 Add json request 2013-07-15 11:43:28 +02:00
Tom Streller
d966f17704 require getCreds method 2013-07-14 14:14:31 +02:00
Tom Streller
3457bfd3a0 Initial import 2013-07-14 11:11:44 +02:00