SMF 2.0 "REST" API

Started by Andre N, November 10, 2011, 09:29:31 PM

Previous topic - Next topic

hebelehubele

Quote from: Kindred on February 14, 2013, 07:24:49 AM
ummm...   If I read it correctly, you are doing the exact opposite. You are attempting to get the SMF user data, not set it...

Actually, I attempted to get user info that understand user was logged in... Can you help me for this api ? How can I send data to login action ? The data stored in SMF member table in DB

Kindred

wait... you seem to be talking at cross purposes here.

HWich is th eprimary system?

Do you have an outside system which you want to pass data TO SMF and control the interface?
or
Do you have an outside system which you want to accept data FROM SMF and allow SMF to control the interface?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

hebelehubele

First one.

I have an outside system. If I login into outside system, login to SMF too.

hebelehubele

Ok I separeted my logins. I send data to smf with iFrame and it login itself. After I register my own session. But SMF login system F.ck [nofollow] my own session.  >:(

How to change smf Session.Save [nofollow]_Path... I think , if I change this I can separate my sessions.

hebelehubele

How to logout from SMF with outside link ?

Arantor

Why not just have *one* login system and be done with it? Much lighter on the system, uses less bandwidth too.

hebelehubele

Because , SMF is later integrate to our CRM software.

Kindred

what does that have to do with anything?

This is what I was trying to get at...   Arantor just put it better.   This entire design should be setting *ONE* system to handle control and then just pass through data.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

hebelehubele

I already use one login system... Send login data to SMF login in the backend. I passed this issue.

My actual issue is logout from SMF from backend. I don't kill SMF session with session_destroy();

leggendario

Quote from: Andre N on December 20, 2011, 10:58:41 AM

If you're on the same domain, use the regular API, which will let you login and logout easily.
http://www.simplemachines.org/community/index.php?topic=453008.0
Otherwise I'd recommend examining jquery's smf login method and duplicating that.

I need to login in my hxxp:test.backend.local [nonactive] and in my hxxp:test.forum.local [nonactive]
I googled a bit 'around but I could not find anything about this jquery's smf login method
could you give me some info, please?

webgab

Hey there,

I'm new to SMF and this API. I'm developing a browsergame in PHP and want to connect SMF with my game. The game is on my local server (game.domain.com) and SMF is on Webhoster (smf.domain.com).
I have one Question.

The login function:
What does 'Will only log them in remotely as cookies cannot be set cross-domain' mean exactly? In gerneral I'm using the same domain, with differnt sub-domains. Can I set cookies when I'm on the same domain (, but differnt sub-domains)?
What does remotely mean? Will the User be redirected to the Forum and then logged in?

Webgab

Kindred

set your smf cookies to be subdomain independent.
set your other program's cookies at the root domain rather than the subdomain.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

webgab

#32
Today I wanted to test this out, but I'm doning something horrible wrong  ;D

I uploaded the api and session folder to the smf root. Edited the secret key etc. And then I made a new php data:

<?
require_once('lib/SmfRestClient.php');
$secretKey = 'Secret Key here';
$api = new SmfRestClient($secretKey, 'raw');
$api->login_user('webgab');
$result = $api->get_userInfo();
var_dump($result);
?>


I'm always getting a 404 error:

string '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /api/get/userInfo.raw was not found on this server.</p>
</body></html>
' (length=218)


Edit: Got the problem: .htaccess wasn't active :D

But now, the login isn't working. I set the cookies to be independant. When I'm pasting the requested URL into my browser anything works fine. But when i'm calling my API script (sub.domain.com/api.php) it doesnt work. Why?
Do I have to put the api.php on the main domain? (domain.com/api.php)


Taidaishar

Quote from: Arantor on February 15, 2013, 07:41:11 AM
Why not just have *one* login system and be done with it? Much lighter on the system, uses less bandwidth too.

I have been combing the treads here and I think this is the what I have been looking for.
I would like to have one registration and log on for my website and forum.
my current file structure on my host is:

public (containing index.php [wich is the welcome/login page])
    Home Directory which includes the multiple webpages as well as Forum directory
           Forum directory (the actual SMF forum)

What I would like to do is ensure the webpages in the Home file are not accessible without loggin in and be able to have the members register and/or log on from the welcome page of my website  (opening the home page of my website upon login) using the SMF login/registration system. Then, through the menu bars on each webpage, be able to navigate to the forums and back without an additional log in prompts.

Is this possible and if so how would I set this up or where can I find the information?
Please let me know if more info is needed.

Kindred

you don't need the API for that at all.
The API is for joining together two disparate systems.

For what you want to do (use SMF login and regsitration and use smf permissions) then SSI is the best choice (and the simplest)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

vart001

I can use the API for this?:
forum: www.domain1.com
website at: www.domain2.com

API: domain2.com need that can do login, restrict access to pages for members only, register etc..

Both domains are on the same server and can share the same database.
You can use the API for this purpose?

Thank you.

Kindred

no.

Logins will NOT transfer across domains... for very good reasons. the login sets a session and a cookie. If the cookie was set for a different domain, it would trigger all sorts of virus warnings in modern browsers.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

vart001

thank you very much.
I understand that the transfer of cookies is not possible for security reasons.

I want 2 websites using the same database and same user system, I think I'll have to abandon my project.
thanks

Kindred

if they are on the same server, you can use feline's subforum mod...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

seekaprice

Does any one know where I can get the api files?

Advertisement: