Facebook APP User ID - facebook-php-sdk

I created a php script, using a standard php example on how to get user information (user id and name) with PHP Facebook SDK.
I also created 2 facebook apps (one before one month and a second today).
When I use the first app with my code, I get back the right Facebook User ID but when I use the second app I get back something like this 10152375153XXXXX instead of my id.
Both of these apps have the same settings.
Has FB changed something in the new apps?

As of 4/30/2014 and the launch of the Graph API version 2.0, applications will receive what is called an "app-scoped" id instead of the canonical Facebook user id. This is a benefit to users as less information is being provided to app developers and they are more in control. It also stops different apps (not owned by the same developer) from associating users and their data. https://developers.facebook.com/docs/graph-api/quickstart/v2.0

Related

How Does Firebase Analytics count New Users in Web App

We have a web app that users log into using Firebase Auth. According to our the authentication section of our firebase console, we have 690 user that have created accounts, and we believe that is correct.
According to our Firebase Analytics console, we have 2,100 new users in the past 90 days. I think I understand that Firebase Analytics tracks users with a device ID (?). So, if this were a iOS app, an uninstall and install would trigger a a new user counted in analytics. But, how does this work on a web app? Cookie? Some kind of browser id? A session?
So, I think if we want to track unique users accurately, we would use the set the user id, with this:
https://firebase.google.com/docs/reference/js/firebase.analytics.Analytics#setuserid
Which according to the docs linked above, 'Use gtag 'config' command to set 'user_id'. So it does this: https://developers.google.com/analytics/devguides/collection/gtagjs/cookies-user-id#set_user_id
Which allows the users to be tracked across sessions. Therefore, users should not double count.
Notice that the setUserId section in the firebase analytics docs does not have a web section (although the setUserID function does exist in the javascript sdk as shown tow links above) https://firebase.google.com/docs/analytics/userid
So... would it then work to get the user id (uid) when they log in (https://firebase.google.com/docs/reference/js/firebase.User). And then use the setUserId method to set the id?
It's unclear because the documentation does not seem to be in one source. I am just trying to put it all together
You are correct that you can use the setUserId API (across iOS, web and Android) in order to identify the same user across platforms. Note that you'll need to:
Set the default reporting identity to "By User-ID then Device" in the Reporting settings for Google Analytics in the Firebase console (see attached screenshot and docs for more info).
Make sure you are following the Privacy Policy when using the User ID.

Flutter - Create sharable profile link

I am trying to create a Social media kind of networking Flutter app in which user can share his profile link. That link must redirect directly to user's profile if app is installed else redirect to link to download app. I am using Firebase as backend. Any resources or packages to work with?
You can use the package Share to enable the user to share their profile themselves. Its really easy to use.
If you would like to share a profile you will need to provide the navigational route to get to the profile screen, then provide the user's ID/data to get/view the desired data.
As far as getting a deep link to get the user to download the app if it is not installed, you can use firebase's dynamic link feature. You can customize what the link preview looks like and says. They have really good docs that you can follow.
You could use a Firebase dynamic link.
A dynamic link is basically a link pointing to possibly 3 resources:
Web URL
Android (Google Play) App ID
iOS (App Store) App ID
So once you configure it on Firebase (it's simple to configure), when the user access the link, Firebase will employ a decision tree to decide where to send the user.
In case the access is done on a mobile device, but if the app is not downloaded, it'll send the user to the store, and after returning from the store, will send the user to the correct path you've configured, following the link.
And on the app, you can implement the SDK to handle this link and when receiving this route request, redirect the user to the right profile they want to access.
I could go through the whole process, but I suggest you check the whole Firebase documentation:
https://firebase.google.com/docs/dynamic-links
In case you have a question on that where I can explain further, just let me know.

Why do I get downloads from the US even though my app is only available in the German Play Store?

I recently released my quiz app in the german Play Store and I get some impressions/downloads from the US which is odd since it should not be visible to the Play Store there. I am using Firebase authentication and I also see that some users authenticate but in my database they don't have an account (username, avatar etc.) which also can't be because after you login with Google you get to a page where you can choose your username and in the second you reach to this site, a user document will be automatically created, but in some cases it does not get created.
I noticed this behavior since my app was in beta testing.
Is it a normal behavior that there are some users who can see and are able to download an app that is usually only available in one country?
It can happen because google play console generates pre-launch reports for your app, so I think they use dummy accounts to login into your application. It can also happen when you submit an update to your app and it goes through a review process.

Analytics API: I can't use two different API credentials on my PC

I've 2 different API keys enabled on 2 different accounts. One professional and the second private and I don't want to link the 2.
My problem is that I've been working with the professional API credentials for almost 3 months and everything works fine. Now, I've created a new account with a new Analytics account and my problem is that I can't use the new API directly with my new Analytics account.
I can't make my script to authorize the new user and I receive an error that says that the user does not have sufficient permissions for this profile.
I managed to make it work by adding my private account as a user in my professional Analytics account. It seems like I can't make another account authorization even if I'm using a different API created on another account. It's like the connects to the first account authorized on my PC.
Is there any way to reset the authorization on my PC each time I want to use one of the API?
Thank you,
EDIT: I'm running a Python script that uses the Analytics API and the only time I have a prompt to authenticate it's the first time I use the application on a new PC. After that, the script runs without any prompt, The credentials are those of the API (client ID and Client secret) and I'm not using them directly but I'm using the client_serets.json file generated on the Google dev console.
I have figured it out. You'll have to navigate to this url https://myaccount.google.com/permissions?pli=1 and remove the service you want to remove.

How to write to our own calendar via the Google Calendar API (v3)

I need to write to a Google Calendar from data in our datastore (App Engine app).
I want to access via OAuth 2.
Reading is no problem - the calendar is public and I just use the simple API access method.
Writing is a "problem" - obviously I need to authenticate. However, the calendar is owned by the app administrators, and we want to write to the calendar as a background task - no user interaction is required.
I have gone through all Google's documentation, but I feel none the wiser - how can I do a one -time setup for permanent write access to a Google Calendar, via the V3 API?
To make calls on behalf of your App Engine app without user interaction you should make use of the App Identity module:
https://developers.google.com/appengine/docs/python/appidentity/
If you are using the Google API Client Libraries, using the AppAssertionCredentials object will do this automatically for you:
https://developers.google.com/api-client-library/python/guide/google_app_engine#ServiceAccounts
Note the following:
You will probably still need to supply the simple key in order to attribute quota usage to the right project.
The App Identity module won't work during local App Engine development - you will need to deploy into production in order to obtain valid credentials.
You will need to share the calendar you are writing to with the email address associated with the service account for the App Engine app. To find this email address go to the App Engine Administration Console -> "Application settings" and look for the service account email.
Finally, I'm not 100% sure that the Calendar API allows service accounts direct access, but you should give this a try. If that doesn't work for you an alternative may be to generate a refresh token for a real user that has access to the calendar, and look at embedding that into your application - the service account method is preferable, so I would try that first.

Resources