Comments (6)
Closing, I guess it had to do with Google's security settings, not the library itself.
from haskellnet-ssl.
Yeah, this was reported a while back on haskell-cafe -- the reason is that Google now calls any app which doesn't use OAuth 2 "insecure", and by default disables it for accounts not using two-factor authentication. You can re-enable it here:
https://www.google.com/settings/security/lesssecureapps
I think normal password logins do work if you have 2FA enabled and you generate an app-specific password for your account, so if you don't want to enable a setting called "allow less secure apps to access my account" (!), you could do that instead.
I have started work on connecting with OAuth 2, though currently that's just locally on my machine and not pushed yet, and it's taken a bit of a back-seat to other work I have going on. I may push the branch in the state it's currently in, in case anyone else wants to get it working...
from haskellnet-ssl.
I havent found another haskell lib that provides easy Gmail with OAuth 2 yet, and it would be nice to avoid 2FA for this particular app I'm building (it uses a shared gmail account). So I would be very interested to try it out for the next version of the app I'm working on.
At the very least I could test out your oAuth 2 branch and report the results.
Thanks!
from haskellnet-ssl.
OK, I've pushed my WIP commit here: dpwright/HaskellNet@d7311ee
I'd forgotten, but as this is nothing to do with SSL/TLS the change required is to https://github.com/jtdaugherty/HaskellNet, not HaskellNet-SSL. The code in that commit looks like it should work according to the spec, but the server returned an error when I tested it. I didn't spend an awful lot of time with it.
I think I'll reopen this issue while we're talking about it, in case anybody else has trouble with the gmail example...
from haskellnet-ssl.
There is a logical error in the code. If authentication works, it will always print: "Authentication error."
The if-statement is wrong. Add 'not' before 'authSucceed', then it will work. Moreover, as above suggested, it is mandatory to enable access from less secure apps, otherwise an exception will be thrown.
smtpTest = doSMTPSTARTTLS "smtp.gmail.com" $ \c -> do
authSucceed <- SMTP.authenticate LOGIN username password c
if (**not** authSucceed)
then print "Authentication error."
else sendPlainTextMail recipient username subject body c
where subject = "Test message"
body = "This is a test message"
from haskellnet-ssl.
I will close this issue as it's not related to this repository, and requires using OAuth. If anyone is interested in accessing Gmail without enabling access to "insecure apps", https://hackage.haskell.org/package/gogol-gmail looks promising. If you want to use IMAP/SMTP/HaskellNet using OAuth, I'd recommend opening a related issue in https://github.com/jtdaugherty/HaskellNet.
from haskellnet-ssl.
Related Issues (15)
- maxLineLength too small HOT 1
- Why not to re-export HaskellNet modules? HOT 2
- stack build tools support HOT 3
- IMAP's `fetch` results with extreme memory usage and computer freezing. HOT 1
- missing `bsWaitForInput' in connectionToStream HOT 1
- smtp-example gives exception HOT 4
- 503 error when using SMTP.doSMTPSTARTTLS HOT 3
- Not in lts-13.0 HOT 1
- Module ‘Network.Socket.Internal’ does not export ‘PortNumber’ HOT 7
- Add package to Stackage LTS 16 HOT 4
- Example broken HOT 1
- Cabal dependencies HOT 2
- TLS fails to authorise if the server stopped supporting HELO command
- Could not install from hackage HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haskellnet-ssl.