Login to CMS through ManiaConnect

Maniaplanet public API, ManiaConnect system and the open source PHP SDK.

Moderator: NADEO

Post Reply
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Login to CMS through ManiaConnect

Post by BLiNNeMaNS »

Hey all, was hoping you guys could help me out a bit..

What i'm trying to do:

Add "Login with ManiaConnect" to the options of a CMS login/register screen
( for example WordPress/Drupal/MyphpBB etc)

any ideas?? thanks in advance
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Re: Login to CMS through ManiaConnect

Post by BLiNNeMaNS »

what i tried to do:
  • take maniaconnect
  • port it to another oauth2 api
  • use a plugin based on that other api to login
what didn't work
  • write own plugin
  • login with maniaconnect
  • override login authentication with custom one

edit:
guess my 1st idea was the best after all...

Found a great one called HybridAuth which kinda works as a communication handler.
unfortunately i'm still puzzled on how to set it up.

(sent a pm to gouxim, hope to get some more info soon)
User avatar
magnetik
Posts: 1673
Joined: 01 Feb 2012, 19:13
Location: Bordeaux
Contact:

Re: Login to CMS through ManiaConnect

Post by magnetik »

It's better to ask your full question directly here than in PM.

You should be able to use anyt OAuth 2.0 compatible version.
We built our service on a quite old revision of the OAuth 2.0 draft so a few adjustments may have to be done on your side.

What errors did you get ? Any code to show us ?
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Re: Login to CMS through ManiaConnect

Post by BLiNNeMaNS »

magnetik wrote:It's better to ask your full question directly here than in PM.

What errors did you get ? Any code to show us ?
My main problem is the fact i've got a short attention span(adhd) when it comes to reading dry text without visuals. That's why i'm more of an interface builder with basic knowledge of coding and a good friend called google.

The 3 examples added to the webservices sdk work great. Login does the trick, no errors at all.

Problem is the implementation of the outcome.
(letting the cms know the user is logged in, bypassing the login screen and, if available, assign user privileges)

I've been doing the wrong thing all the time, this is probably how i should do it
  • user clicks login button
  • maniaconnect oauth handles user validation
  • maniaconnect sends user to backlink
  • backlink extracts username + checks if screenname's still same
  • username + screenname (the $fc0$w$0username) is added to database
  • other info is added to Localstorage/Sessionstorage
  • Pingback to maniaconnect
  • maniaconnect checks if user is logged in
  • if valid, bypass login and grant access
  • site checks user role and assigns privileges
So i guess my problem wasn't the "getting maniaconnect to work", but "bypassing the login screen"

small update:
decided not to run wordpress after all.
Although wordpress has maniapress, i think i'll pass and write my own templating system instead.

will keep you posted.


I do have a question though:
- is it possible to check if a user has bought the game or is a free account player?
(only allow post access to those ppl i can remove rights from if they misbehave without them just registering a new account and troll the site again)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

Re: Login to CMS through ManiaConnect

Post by gouxim »

BLiNNeMaNS wrote:but "bypassing the login screen"
Yes indeed the difficulty will be here. It will depend what CMS you use (wordpress, custom, whatever), but in any case it will be on your side rather than Nadeo's (ie. maniaconnect's side).

Maybe you can find help in the forum from other players to help you achieve what you want to do.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Re: Login to CMS through ManiaConnect

Post by BLiNNeMaNS »

i've just come up with a workaround for the problem.

not rocksolid, but it will probably do the trick for now:
  • load webservices/autoload.php
  • check if http or maniaplanet and show content
  • if http in header, don't show oauth login
  • else show oauth login *ingame maniaplanet browser only*
  • after succesful login, add username/id/token to seperate table, see "add content" option appear
  • formfield username (mandatory) is auto filled in with username+hidden string, nickname shown
  • formfield username can't be selected, username pulled from database, has to have certain hidden string
it's not a rocksolid approach, but it'll probably work right?



edit: would even be better if the manialink in the header would work as a domainname instead of showing the full browserpath
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Re: Login to CMS through ManiaConnect

Post by BLiNNeMaNS »

okay, almost there ^^

now i only need to know at what part of the session i need to write to database
Post Reply

Return to “Maniaplanet Web Services”

Who is online

Users browsing this forum: No registered users and 1 guest