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.
 

Example: SSO and Authed CREST access with Django (Python)

Author
Florian Lousberg
Furtherance.
#1 - 2015-03-11 19:03:29 UTC
Hello fellow 3rdparty devs!

I recently spent some time to figure out how to use EVE Online Single Sign-On (SSO) for my Django project and especially how to access the Authenticated CREST (Nom nom, tasty market data! P).

Example app on GitHub:
https://github.com/flesser/django-crest-example

Live Demo:
http://django-crest-example.dubiose-briefkastenfirma.de/

It relies on Python Social Auth to do the login stuff and uses PyCrest to interact with CREST.

I plan to eventually continue this project and create some kind of general CREST wrapper for Django.

o7
Safdrof Uta
Echelon Research
Goonswarm Federation
#2 - 2015-04-22 12:26:01 UTC
Hey there.

I'm trying to get this working for my project, but am coming across an error when it redirects to /complete/eveonline.

Exception Type: ConnectionError at /complete/eveonline/
Exception Value: You have not defined a default connection


Any idea what might be causing this?

(Full stack available at http://pastebin.com/3SzdArwS )
Safdrof Uta
Echelon Research
Goonswarm Federation
#3 - 2015-04-22 12:26:59 UTC
Also - When I go to localhost:1000/ it wants to redirect me to /account/login instead of /login
Drala Ormand
The Scope
Gallente Federation
#4 - 2015-04-30 20:29:05 UTC
Hello Florian,

That's really well done! Thanks for developing that proect. Motivated me to learn django :)

Drala
Free Bullets
Xof Shipping and Indy
#5 - 2015-05-07 17:07:30 UTC
I love you.
Florian Lousberg
Furtherance.
#6 - 2015-05-09 12:25:00 UTC
Sorry for the late answer, I just read this thread again. (I assumed that "subscribe" a thread meant "receive E-Mail notifications when someone answers it", but sadly that does not seem to be the case).

Safdrof Uta wrote:
Hey there.

I'm trying to get this working for my project, but am coming across an error when it redirects to /complete/eveonline.

Exception Type: ConnectionError at /complete/eveonline/
Exception Value: You have not defined a default connection


Any idea what might be causing this?

(Full stack available at http://pastebin.com/3SzdArwS )


From the stack it looks like something MongoDB-related.
Did you specify a 'default' database connection in your settings.py?
DATABASES = {
    'default': {
        'ENGINE': '...',
        ...,
    }
}

I haven't worked with MongoDB yet, but googling the error message gave me some StackOverflow answers with different possible explanations for that error.

Safdrof Uta wrote:
Also - When I go to localhost:1000/ it wants to redirect me to /account/login instead of /login

You have to specify LOGIN_URL = '/login/' in your settings.py, see my example file. If not, it defaults to /account/login.
Safdrof Uta
Echelon Research
Goonswarm Federation
#7 - 2015-05-28 05:38:33 UTC
Florian Lousberg wrote:
Sorry for the late answer, I just read this thread again. (I assumed that "subscribe" a thread meant "receive E-Mail notifications when someone answers it", but sadly that does not seem to be the case).

Safdrof Uta wrote:
Hey there.

I'm trying to get this working for my project, but am coming across an error when it redirects to /complete/eveonline.

Exception Type: ConnectionError at /complete/eveonline/
Exception Value: You have not defined a default connection


Any idea what might be causing this?

(Full stack available at http://pastebin.com/3SzdArwS )


From the stack it looks like something MongoDB-related.
Did you specify a 'default' database connection in your settings.py?
DATABASES = {
    'default': {
        'ENGINE': '...',
        ...,
    }
}

I haven't worked with MongoDB yet, but googling the error message gave me some StackOverflow answers with different possible explanations for that error.

Safdrof Uta wrote:
Also - When I go to localhost:1000/ it wants to redirect me to /account/login instead of /login

You have to specify LOGIN_URL = '/login/' in your settings.py, see my example file. If not, it defaults to /account/login.


Thanks!

Yeah, it was MongoDB related. I removed Mongo from the app and it worked well. I've not had a chance to look at this lately, but now my issues is that when I sign into the app with an account that has already signed in, I get an error of "Social Auth already Exists!" Most other things work well.