These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
12Next page
 

SSO Auth to make crest calls from an application (not a website)

First post
Author
Kale Freeman
Garoun Investment Bank
Gallente Federation
#1 - 2015-06-16 13:17:19 UTC  |  Edited by: Kale Freeman
I can't figure out how to do this. If someone can give me some high level pointers or sample code (I dont mind what language).

For now I just want to be able to auth as myself, make a crest call and log the result to a file. Nothing fancy, but my googlefu isn't strong enough.

I suspect that I can't use the SSO auth and I need some other mechanism to get my auth token, but I can't find any information anywhere.
Jarno Midumulf
Riders of Sleipnir
Backdoor Crashers
#2 - 2015-06-16 14:12:01 UTC
Kale Freeman wrote:
I can't figure out how to do this. If someone can give me some high level pointers or sample code (I dont mind what language).

For now I just want to be able to auth as myself, make a crest call and log the result to a file. Nothing fancy, but my googlefu isn't strong enough.

I suspect that I can't use the SSO auth and I need some other mechanism to get my auth token, but I can't find any information anywhere.


it depends on what kind off "application" you want..
you say that you aren't making a website, then what? what langues? (like c#, c++, java, phyton, ect..)

provide that information and we can help you more.
Kale Freeman
Garoun Investment Bank
Gallente Federation
#3 - 2015-06-16 17:48:11 UTC
Jarno Midumulf wrote:
Kale Freeman wrote:
I can't figure out how to do this. If someone can give me some high level pointers or sample code (I dont mind what language).

For now I just want to be able to auth as myself, make a crest call and log the result to a file. Nothing fancy, but my googlefu isn't strong enough.

I suspect that I can't use the SSO auth and I need some other mechanism to get my auth token, but I can't find any information anywhere.


it depends on what kind off "application" you want..
you say that you aren't making a website, then what? what langues? (like c#, c++, java, phyton, ect..)

provide that information and we can help you more.



Help can be in any language. My problem is that I can't figure out how to get a windows desktop fat client application to successfully auth (as myself) so that it can make CREST calls. I will probably write my application in Java but if someone if able to help me in some other language, please do.
Wacktopia
Fleet-Up.com
Keep It Simple Software Group
#4 - 2015-06-17 19:26:30 UTC  |  Edited by: Wacktopia
The CREST OAUTH loop back requires a URL. With a desktop app you do not have that.

In order to make it work you'd need to pop a browser window and the capture the return from an online source via a web service or maybe (shudder) hijack the return query string data using OLE or something.

Iirc CCP mentioned the SSO for crest was for websites only but check with FoxFour.

Edit: not sure this would work or be allowed but you could set the return url to a http://localhost:blahport address and then bind to that port from your application.

Kitchen sink? Seriousy, get your ship together -  Fleet-Up.com

SJ Astralana
Syncore
#5 - 2015-06-18 00:23:00 UTC
On another app I authenticate to Windows Azure Active Directory silently with a client ID and secret, and it returns a token. Out of curiosity, is silent auth in this fashion part of the Oauth spec?

Hyperdrive your production business: Eve Production Manager

Pete Butcher
The Scope
Gallente Federation
#6 - 2015-06-18 06:02:47 UTC
You can check out the source code for evernus and see how it's handled there. It basically uses 2 methods: internal Web engine for the user to authenticate, and opens an external browser and waits for the users to input a code from it. The first method is best for reliability, while the second is best for user trust.

http://evernus.com - the ultimate multiplatform EVE trade tool + nullsec Alliance Market tool

Pete Butcher
The Scope
Gallente Federation
#7 - 2015-06-18 06:06:21 UTC
Wacktopia wrote:
not sure this would work or be allowed but you could set the return url to a http://localhost:blahport address and then bind to that port from your application.


From my experience, that is the least reliable option, so I wouldn't recommend it. Unless you aim for a small user base and don't really care if it works on a broader scope.

http://evernus.com - the ultimate multiplatform EVE trade tool + nullsec Alliance Market tool

Kale Freeman
Garoun Investment Bank
Gallente Federation
#8 - 2015-06-19 10:18:42 UTC
Everything I see suggested is basically a hack. Probably be easiest to just HTTP get the form. HTTP post a form submission as if I was a browser and then parse the token out of the response.

Not too difficult, but it leaves me feeling slightly dirty.

Anyway, thanks for the suggestions.


Pete Butcher
The Scope
Gallente Federation
#9 - 2015-06-19 11:09:12 UTC
Kale Freeman wrote:
Everything I see suggested is basically a hack. Probably be easiest to just HTTP get the form. HTTP post a form submission as if I was a browser and then parse the token out of the response.

Not too difficult, but it leaves me feeling slightly dirty.

Anyway, thanks for the suggestions.




You should use a Web engine for that, otherwise your app won't inspire much trust.

http://evernus.com - the ultimate multiplatform EVE trade tool + nullsec Alliance Market tool

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#10 - 2015-06-19 11:30:18 UTC
https://github.com/fuzzysteve/CREST-Market-Downloader

uses CREST to download market data.

Handles the auth by throwing the user off to their system browser to do the authentication, and gets the relevant tokens by having an embedded webserver, which acts as the endpoint you're redirected back to.


If you embed a web browser in your application, I'm not going to use it (and neither should anyone who doesn't trust you. As I can't reach out and touch you, I'm likely never to trust you enough)

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Pete Butcher
The Scope
Gallente Federation
#11 - 2015-06-19 12:23:14 UTC  |  Edited by: Pete Butcher
Steve Ronuken wrote:
https://github.com/fuzzysteve/CREST-Market-Downloader

uses CREST to download market data.

Handles the auth by throwing the user off to their system browser to do the authentication, and gets the relevant tokens by having an embedded webserver, which acts as the endpoint you're redirected back to.


If you embed a web browser in your application, I'm not going to use it (and neither should anyone who doesn't trust you. As I can't reach out and touch you, I'm likely never to trust you enough)


Having the user to manually enter the code is much more reliable than a local web server.

http://evernus.com - the ultimate multiplatform EVE trade tool + nullsec Alliance Market tool

Kale Freeman
Garoun Investment Bank
Gallente Federation
#12 - 2015-06-20 06:10:03 UTC
Steve Ronuken wrote:
https://github.com/fuzzysteve/CREST-Market-Downloader

uses CREST to download market data.

Handles the auth by throwing the user off to their system browser to do the authentication, and gets the relevant tokens by having an embedded webserver, which acts as the endpoint you're redirected back to.


If you embed a web browser in your application, I'm not going to use it (and neither should anyone who doesn't trust you. As I can't reach out and touch you, I'm likely never to trust you enough)




So I'm basically stuck with two options,
1. build an embedded browser into the app (which quite rightly should not be trusted, could compromise my eve account)
2. build an embedded server into the app and on installation get the person to open a port on their firewall where the app will listen (which should REALLY not be trusted, it could be receiving commands from anywhere and doing pretty much anything on my computer, compromise my entire PC)


None of this really matters in my case because I am building this application for myself, but if someone was building a fat client app for the general public, is there any way they can use SSO that would be "trustworthy"? It doesn't seem so.
Kale Freeman
Garoun Investment Bank
Gallente Federation
#13 - 2015-06-20 06:15:36 UTC
Pete Butcher wrote:
Kale Freeman wrote:
Everything I see suggested is basically a hack. Probably be easiest to just HTTP get the form. HTTP post a form submission as if I was a browser and then parse the token out of the response.

Not too difficult, but it leaves me feeling slightly dirty.

Anyway, thanks for the suggestions.




You should use a Web engine for that, otherwise your app won't inspire much trust.



The web engine will make it *look* more trustworthy, but wouldn't actually make it more worthy of trust.
Pete Butcher
The Scope
Gallente Federation
#14 - 2015-06-20 06:19:10 UTC  |  Edited by: Pete Butcher
Kale Freeman wrote:
Steve Ronuken wrote:
https://github.com/fuzzysteve/CREST-Market-Downloader

uses CREST to download market data.

Handles the auth by throwing the user off to their system browser to do the authentication, and gets the relevant tokens by having an embedded webserver, which acts as the endpoint you're redirected back to.


If you embed a web browser in your application, I'm not going to use it (and neither should anyone who doesn't trust you. As I can't reach out and touch you, I'm likely never to trust you enough)




So I'm basically stuck with two options,
1. build an embedded browser into the app (which quite rightly should not be trusted, could compromise my eve account)
2. build an embedded server into the app and on installation get the person to open a port on their firewall where the app will listen (which should REALLY not be trusted, it could be receiving commands from anywhere and doing pretty much anything on my computer, compromise my entire PC)


None of this really matters in my case because I am building this application for myself, but if someone was building a fat client app for the general public, is there any way they can use SSO that would be "trustworthy"? It doesn't seem so.


Well, Evernus has CREST since it was introduced to us, and I can confirm - there is no good way to make it work with the best UX and full trust for desktop apps. OAuth is better suited to web applications. Real world experience shows that:


  • Embedded browser has the best UX, best reliability, but the worst trust.
  • External browser with manual code input has the worst UX, but it's quite reliable (although not as much as embedded) and trustworthy.
  • Local web server has the same worst UX and it's not reliable at all.


You should discard local web server (unless you want a ton of bug reports, which you wouldn't be able to fix in any other way than dropping the idea), and focus on external auth with manual input and embedded web server. I have them both in Evernus and the user can choose what he/she prefers. Embedded server is used by default to smoothen the UX, but the user can press a button and through browser-based auth. It's been around around for months and I get absolutely no complaints and no bug reports about it.

Kale Freeman wrote:
The web engine will make it *look* more trustworthy, but wouldn't actually make it more worthy of trust.


That is very true, but if you make some kind of in-app form to log into Eve, I doubt anyone will use that. That method should not be used at all.

http://evernus.com - the ultimate multiplatform EVE trade tool + nullsec Alliance Market tool

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#15 - 2015-06-20 17:34:20 UTC
Kale Freeman wrote:
Steve Ronuken wrote:
https://github.com/fuzzysteve/CREST-Market-Downloader

uses CREST to download market data.

Handles the auth by throwing the user off to their system browser to do the authentication, and gets the relevant tokens by having an embedded webserver, which acts as the endpoint you're redirected back to.


If you embed a web browser in your application, I'm not going to use it (and neither should anyone who doesn't trust you. As I can't reach out and touch you, I'm likely never to trust you enough)




So I'm basically stuck with two options,
1. build an embedded browser into the app (which quite rightly should not be trusted, could compromise my eve account)
2. build an embedded server into the app and on installation get the person to open a port on their firewall where the app will listen (which should REALLY not be trusted, it could be receiving commands from anywhere and doing pretty much anything on my computer, compromise my entire PC)


None of this really matters in my case because I am building this application for myself, but if someone was building a fat client app for the general public, is there any way they can use SSO that would be "trustworthy"? It doesn't seem so.



No real need to open a port? Most firewalls don't restrict localhost activity, and that's all you need. Remember, it's not the server initiating to the client, it's the browser initiating a connection to your client. Which is entirely local.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Pete Butcher
The Scope
Gallente Federation
#16 - 2015-06-20 17:43:29 UTC
Steve Ronuken wrote:
Most firewalls don't restrict localhost activity


And that's where you are wrong. For example - my 3 home machines and 2 work machines would not allow that. I bet most corporate machines will scream if any app tried to do that. Add to that other applications which can already open this particular port and you're pretty much screwed. Screwed because it's something that cannot be dynamically changed by the application. Local server is absolutely the worst of the 3 options, since it has the worst UX, has the least chance of working properly and cannot be dynamically fixed on the user side. Also it doesn't inspire much trust, since you will never know if it's contacting some C&C server and stealing your private data from your disk.

http://evernus.com - the ultimate multiplatform EVE trade tool + nullsec Alliance Market tool

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#17 - 2015-06-20 17:49:00 UTC
An alternate option, if you're willing to bring a server you control into the loop:

Someone hits auth. This causes a system browser to open, going to the server you control, sending a guid.

This gets stored on your server, and they're redirect automatically to auth, along with a state token which is stored along with the guid.

Once they auth, they're redirected to your server, where you complete the auth, and store the tokens against the guid.

In the mean time, your client is polling the server every so often (or has a long running connection. both are viable. Short poll, long poll, or web sockets all work here) with the guid. That allows your server to pass along the tokens, when they come in.


Sure, it means that your server has their details (the tokens. not their username/password). But they may trust you enough for that (as your client could send them on too)

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Pete Butcher
The Scope
Gallente Federation
#18 - 2015-06-20 18:01:07 UTC
Steve Ronuken wrote:
An alternate option, if you're willing to bring a server you control into the loop:

Someone hits auth. This causes a system browser to open, going to the server you control, sending a guid.

This gets stored on your server, and they're redirect automatically to auth, along with a state token which is stored along with the guid.

Once they auth, they're redirected to your server, where you complete the auth, and store the tokens against the guid.

In the mean time, your client is polling the server every so often (or has a long running connection. both are viable. Short poll, long poll, or web sockets all work here) with the guid. That allows your server to pass along the tokens, when they come in.


Sure, it means that your server has their details (the tokens. not their username/password). But they may trust you enough for that (as your client could send them on too)


That's another option, but it's less secure than local server and manual input. It takes more time, because the app needs to ping the server. It also wastes resources, since the app needs to constantly ping it until success. Add to that the increased complexity, and I think simple Ctrl+C, Ctrl+V from a browser, into the app is a cleaner solution.
A real solution would be an auth method better suited for desktop apps, but I don't think it will happen soon, if at all.

http://evernus.com - the ultimate multiplatform EVE trade tool + nullsec Alliance Market tool

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#19 - 2015-06-20 18:03:11 UTC
Pete Butcher wrote:
Steve Ronuken wrote:
Most firewalls don't restrict localhost activity


And that's where you are wrong. For example - my 3 home machines and 2 work machines would not allow that. I bet most corporate machines will scream if any app tried to do that. Add to that other applications which can already open this particular port and you're pretty much screwed. Screwed because it's something that cannot be dynamically changed by the application. Local server is absolutely the worst of the 3 options, since it has the worst UX, has the least chance of working properly and cannot be dynamically fixed on the user side. Also it doesn't inspire much trust, since you will never know if it's contacting some C&C server and stealing your private data from your disk.



If your target market is 'properly locked down corporate machines' you're screwed anyway. Because you won't have the rights to:

A: install it
B: run it

As for the C&C thing, that's a dumb reason. Because it /has/ to have net access. It talks to CREST. And if it can talk to CREST, it can talk to other things.

Aside from that, you do know you can bind servers to listen /only/ to localhost, right?

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Pete Butcher
The Scope
Gallente Federation
#20 - 2015-06-20 18:23:53 UTC  |  Edited by: Pete Butcher
Steve Ronuken wrote:

If your target market is 'properly locked down corporate machines' you're screwed anyway. Because you won't have the rights to:

A: install it
B: run it

As for the C&C thing, that's a dumb reason. Because it /has/ to have net access. It talks to CREST. And if it can talk to CREST, it can talk to other things.

Aside from that, you do know you can bind servers to listen /only/ to localhost, right?


I assume the target is not only 'properly locked down corporate machines', but potentially any machine with a firewall/iptables/whatever that can block ports, local or not. That is a potentially large chunk of userbase being discarded for no real reason. Also, if another app is already listening on a given port, you're screwed. Maybe if CREST disregards ports for redirect URLs, that would be partially solvable, but it would invoke searching for another port which could work (or manual input, which would just **** off users). And there's another issue - if another app would require a port which was stolen by our app, the user would surely be pissed off. Try to explain such situation to a stereotypical dumb user. And for what? To save a Ctrl+C, Ctrl+V? That's just absurd.

http://evernus.com - the ultimate multiplatform EVE trade tool + nullsec Alliance Market tool

12Next page