سؤال

Im new to Elgg, My requirement is to create an Elgg plugin to import contact from Gmail,Yahoo and MSN.

I already successfully imported the contacts in Joomla. when I create an Elgg plugin and the Oauth call back url given like invitefriends/gmailcallback or even direct call like

mod/invitefriends/actions/gmailcallback.php

Its not working.

In first case it return form token missing I tried to add form token dynamically like below.

$ts = time();
    elgg_register_action('invitefriends/gmailcallback',
                        TRUE,
                        elgg_get_plugins_path() . 'invitefriends/actions/gmailcallback.php?__elgg_token='.generate_action_token($ts).'&__elgg_ts='.$ts);

But still same error. so I tried to access module file directly it works fine ,but the problem is I didn't get the $_SESSION['oauth_token_secret'] session variable are not getting, it set in default view and have proper value but unable to get that session in action file in direct call method.

Iam not sure its in Elgg standard, Please advice me to solve the problem

Thanks in advance..

هل كانت مفيدة؟

المحلول

Don't use direct call. First thing: you're using deprecated action registration parameters - update your call. I assume you're writing to Elgg 1.8 or later.

You're additng action tokens in completely wrong way! They're necessary to prevent XSRF attacks, so need to pe added at URL generation. To elgg_register_action, you need to pass action file PATH, not URL. Use elgg_add_action_tokens_to_urland read through http://docs.elgg.org/wiki/Actions#Security

You should get specific error telling you that, but you didn't mention it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top