I am trying to retrieve user email via facebook after user authentication on my website.
I ran the query below, but the email and birthday fields are empty ; and they are very vital for registration on my website.
#*** run fql ***
$fql = "select uid, first_name, last_name, name, sex, email, current_location, website, interests, birthday, pic_big from user where uid=me()";
$param = array('method' => 'fql.query', 'query' => $fql, 'callback' => '');
$user = $facebook->api($param);print_r($user);
What do i do please
To access fields like email and birthday you need to request extra permissions during authorization. Full list of permissions is available here.
Related
I am trying to retrieve gender and birthday from Google accounts. I am trying in Google Playground (https://developers.google.com/oauthplayground/) by doing the following:
I authorize all Google OAuth2 API V2 scopes (https://www.googleapis.com/auth/plus.login, https://www.googleapis.com/auth/plus.me, https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile).
Then I generate the access token and finally I make a request to https://www.googleapis.com/userinfo/v2/me.
The information I get is: family_name, name, picture, locale, email, given_name, id and verified_email. I tried many things but I cannot get gender or birthday.
NOTE: The account I am using has both gender and birthday marked as public (checked in https://aboutme.google.com)
I'm trying to add an Item, where one of the fields is of type contact (user), to Podio.
I do not have the contact profile_id, only the name, so I need to search the contact to get the profile_id before adding.
The problem is that the /contact/ resources are inaccessible since I'm using app authentication.
The error is: "Authentication as app is not allowed for this method"
What is the recommended way to do this?
Thanks.
As I can see, the tricky part here is that you have just a name of the user. So you need to search this name first.
To be able to search you should be authenticated not as an app, but as a user with appropriate rights. I believe this is because search functions a rate-limited per user. You may authenticate on client side, server side or just by entering user's email and password (see documentation here).
Then, when authenticated, just use search functions with the parameter "ref_type": "profile" to look for the user name within space, organisation or globally. Example for PHP-client:
$attributes = array(
"query" => "John Doe",
"ref_type" => "profile"
);
$results = PodioSearchResult::space( $space_id, $attributes ); // search in space
$results = PodioSearchResult::org( $org_id, $attributes ); // search in organisation
$results = PodioSearchResult::search( $attributes ); // search globally
Functions above will return an array of the most relative results found. There you can get a user id and other user info.
Note that technically several different users may have the same name, so there might be more that one result found. It will be up to you to choose one of them somehow.
I have user information in my database. I wish to get the ID of a user given the email address. To get this in sql you would write the following query code:
SELECT Id FROM TableName WHERE email_address = "xyz#somename.com";
How do I write this using ASP.NET MVC Entity-Framework?
Well, it depends entirely on your public API, which we have no visibility into. Generally speaking, it would look something like:
var userId = db.Users
.Where(m => m.email_address == "xyz#somename.com")
.Select(m => m.Id)
.SingleOrDefault();
I suggest you take some time with the tutorials at https://www.asp.net/mvc/overview/models-data, to get your bearings.
I have a database with columns sEmail and sPassword. But I need to call :
Auth::attempt(Input::only('email', 'password')
in order to log in my user. So I get a SQL Exception because email and password doesnt exists in my table...
I can't change my columns names, so how is it possible to solve my problem?
Laravel should know that you are using different column names, you should change your code to
$email = $input['email'];
$password = $input['password'];
Auth::attempt(array('sEmail' => $email, 'sPassword' => $password));
I'm trying to create a cakephp website which has a notification system telling people when they log in how many new items they have.
I currently have the site logging every time a visitor logs into the site however I am unsure how I can compare date/timestamps against each other in a find.
What the find should do is return all data that has a newer timestamp when compared to the persons previous loggedIn.created
I am unsure how to code this/just trying to figure out a concept on how I can code this. any help or direction would be appreciated.
To make this simple a
user hasMany logIns
logIns belongsTo user
a user hasMany Invoices
Invoices belongTo user
user has id, name, account_id
loggedin has id, created, user_id
invoice has id, sender, receiver, created, account_id
You can use the normal comparison operators < and > with dates and datetimes.
> means "after"
< means "before"
To find invoices that have been created after a login date in a CakePHP controller, you could write for example:
$previous_login = '2012-09-20'; # obtain from somewhere
$new_invoices = $this->Invoice->find('all', array(
# "created after previous login"
'conditions' => array('created >' => $previos_login)
));