Getting User details from Push API checkin - foursquare

I'm using Foursquare Push APIs in our server. It's working just fine but for one problem. I'm accessing user checkins in my php file as:
$jsonresponse = json_decode($_REQUEST["checkin"]);
and for the user I'm obtaining firstname, lastname etc as usual. But when I try to access user details (email etc.) by:
$jsonresponse->user->contact->email
it returns a blank field. I'm testing with my own 4Sq account so I know my email value is present. Am I missing something?
Thank you all in advance.

The Push API calls contain a compact user as opposed to a full user object (see: https://developer.foursquare.com/docs/responses/user). You'll need to retrieve the full user details to access the contact information (/users/self)

Related

Invite team member functionality in MERN website

I am building a website using mern stack where every user who signs up gets their own subdomain according to the username they entered.
What I have done so far:
Users can create an account and get their subdomain according to the username they entered while signing up.
Owner of the organization can send invites to the team members using email by filling out a simple form where they need to enter the email of the team member.
Now, I would like to know how I can add the team member to the organisation's workspace so they have full access to the workspace. Basically, I don't know what to do after sending an invite.
Please give me some insights on how this can be achieved.
Thanks.
Make an array element in the your model so that contains group_ids of groups joined.
Create a middle-ware function that checks if the user can perform operations in there. If not, throw error.
When the invite is sent, the array element that I talked about should be updated to [...array, group_id selected].
I am a junior developer so might go wrong but I hope this helps.

How to link logged users to their data, retrieve and update them in MySQL table

This is the my web-app "User Settings" page.
I have simplified it to a minimum to better highlight the problem.
To authenticate users I use Auth0, I wanted to use the sub claim user_id to identify the users inside my MySQL database for update and retrieve user's info. Unfortunately the user_id is different for each provider, for example, if the same user with the same e-mail logs-in via Auth0 he gets a user_id if he does it via google he gets another one.
I thought about using email to link logged user to his info.
The problem is in my API. Before the change it was "localhost: 8080 / api / users /: id"
each time it created a new id and in any case it was impossible to recover the data of the single user. Now that I have replaced "id" with "email" my API has also changed in "localhost: 8080 / api / users /: johnsmith#xxx.com".
Before:
After:
In a few words, the request url on the client side has also changed.
I would like to make sure that the GET and PUT requests are made based on the e-mail of the logged user without going to modify the whole back-end.
Sounds like something is wrong with how you authenticate users. If you have multiple ways to authenticate a user, those methods need to be in a one to many relation with the user. For example each user has a list of auth-methods, and whenever an authentication is made you check your table of authentication methods and find the one user it maps to.
Im not sure if you are doing this yourself or if the framework you are using is handling that, but it sounds like you need to change the model to allow many Auth methods for a single account.
Also you could use email, but that is also an "old" way of uniquely identifying users almost every single person has multiple active email accounts nowadays, so you should also have a one-to-many relation for users to emails. What if the user has different email accounts for their Facebook and Google accounts?
See account linking here: https://auth0.com/docs/users/user-account-linking
It is dangerous to trust that the external providers are truthful about what email belongs to who. What if I open a new account using someone else's email on one of the providers? Then I can log into that users account in your application, which is a pretty big security risk.

Get more information about the users in my tenant

I am using the next endpoint https://graph.microsoft.com/v1.0/users to get all users in my azure tenant but it is not showing all information about the users, it doesnt show information as: creation date, last login date, password last change date and others.
How can I get the information required?
Thanks in advance.
Regards,
Arsenio
https://graph.microsoft.com/v1.0/users api only lists the basic properties. If you need to get the other properties, you need to use $select to get them.
https://graph.microsoft.com/v1.0/users?$select=createdDateTime,displayName
All the available user properties are listed here.
Unfortunately, you cannot get all this info from the one API call and some of them you cannot get at all. For example, last login info you can get from auditLogs endpoint or using select field modification from user API:
https://graph.microsoft.com/v1.0/users?$select=displayName,createdDateTime
All field that you can extract from user API you can find here.
For extracting information about some of users activities you can use directoryAudit call, but I'm not sure that you can extract last password change from it.

Facebook endpoint to get user's feeds/posts

So I want to get a user's feeds (or lets say user's posts); based on this documentation I'm calling the following endpoint:
https://graph.facebook.com/{USER_ID}/feed?access_token={MY_ACCESS_TOKEN}
https://graph.facebook.com/{USER_ID}/posts?access_token={MY_ACCESS_TOKEN}
But this is giving me an empty data array; although there are public posts by the user! Am I doing something wrong? Should the user give the permission to my app?
Although the following end point works (which shows user general info), but that's not what I want; I want just a user's posts
https://graph.facebook.com/{USER_ID}?access_token={MY_ACCESS_TOKEN}
Thanks
You have to use facebook login and request permissions from the user to access their posts : "user_posts". This document covers how to request permissions with faceboook login. Once you are granted the user_posts permission, you can use the access token you obtained from the user in your call to get the users feed.

Accessing user information from instagram without user logging

I am working on an iphone app which uses instagram API..and I would like to know the following things..Is it possible to get data from instagram without user logging?If so, what type of data would be retrieved from it?Is it possible to access data of a specified user?Or is it only possible using social networking sites like facebook,tumblr etc?
thanks
Yes, with a valid client id, you can fetch user information for a specific user id. Information available includes name, bio, website, and profile picture. You can also return multiple users' data using the search endpoint.
Take a look at the User Endpoints documented here: http://instagr.am/developer/endpoints/users/
I also suggest reading Do you need to authenticate? section here: http://instagr.am/developer/authentication/
NOTE: by providing a client id instead of a valid user token, you are counting against your own application's 5000 calls per-hour limit. If you plan on having a large user page, you would need to authenticate each user to avoid this limit.

Resources