firebase push notification on specific user by web app in node.js - node.js

I am trying to follow host by user, so I want to get notification for particular user not for other user. backend node.js I am getting device token and saving it in local database I am getting the notification but only for one user. how I can manage for other users.. please help me.

Related

How to display that a user is connected to GitHub

I am developing a website like Heroku. I confused what should I do with the Github OAuth part? when you wanna register in Heroku and login you can not use OAuth ways (login/register using Github).
but after login you can create App. now one of your options to upload your codes in the Heroku is to connect your Heroku account to your Github account.
My problem
When the user is logged in how could I redirect the user to another page and after authentication (Github OAuth) how could I detect that this user previously logged in and the user does not need re-login?
Exactly what the Heroku did.
I can not understand how can I send another data to the Github OAuth login page and retrieve it back in callback url to detect which user is logged in now and save his/her access_token & refresh_token in database.
Not that I use expressjs express-session sequelize and ejs.
GitHub, like all OAuth based APIs, requires that each request to the API made on behalf of a user is authenticated with an access_token. If you don't pass an access_token alongside your request, the request will fail with a 401 Unauthorized status code.
There's no way to ask GitHub if a random user has accepted your app. It's not something implemented in the OAuth framework - as it could lead to a security flaw. So it's your responsibility as the application's owner to record which user has authorized your app.
With this in mind, let's try to sum up the differents steps that Heroku had to achieve to display this "Connected" status under the GitHub logo.
When you've signed-up on Heroku, the status of the GitHub integration was "not_connected". If you visit the settings page, you would see a "Connect to GitHub" button.
At some point, in the Heroku dashboard, you have clicked on the "Connect to GitHub" button and have authorized Heroku's app for GitHub. This is where you've been redirected to the callback_url
At this particular time, while you were on the callback_url page, Heroku has recorded in its database the new status of the GitHub integration for your account. It was set to "connected". Heroku has probably saved alongside the access_token and refresh_token.
Every time that you visit the settings page of your app, Heroku can render that you are connected because it has the status in its database.
(optional) When Heroku performs requests to the GitHub API using your access_token it can confirm that the connection is still live. If ever the request failed with a 401 Unauthorized, Heroku can update its database and reset your GitHub integration status to "not_connected".
This work like this for the GitHub API, as well as with any other OAuth based APIs. If you plan to integrate with several APIs, I highly recommend you to use an API Integrations Manager, such as Pizzly. It will help you focus on the business logic ("is my user connected or not?") and totally handle the OAuth process for you.

How to Migrate from accountKit to Firebase Phone sign up?

I'm using AccountKit for phone sign up right now in our mobile app. As AccountKit will be deprecated soon so we are migrating with firebase phone sign up.
I have set up a new user/Sign-up flow but still confused about old users when they log-in again using a new sign-in method(Firebase).
Current Login Process:
Client request with the access token.
Server request to account kit with an access token and get user data with UID
By this UID I check in current database user present or not.
Problem:
When old user tries to sign in through firebase then I'll get different UID(UID of firebase) which is not present in my database so it will consider it as a new user.
Backend: Node js
Can someone help me what would be the best approach to migrate?

Routing the client app after an account verification

I am building a webapp using nodeJS as the server-side framework and reactJS as the client-side framework.
My issue is the following:
I'm trying to create an account registration mechanism, which is working fine. I do receive an email with a specifc token in order to active an account. The issue that I am facing is that the API which will consume is on the nodeJS side, and I can't figure out how I can force a page to being rendered from the client side as a result of the success, since the API is located on the server on a different port?
Am I approaching this wrongly, and as such I am facing this specific issue?
It's simple you just handle it on both sides,
meaning that you send a verification link in the email so it redirects the user to your application and then on the client app extract the toke (the verification code needed on the verification link from the email) and send it to the server(API) depending on the request status you will take an action, if its verified successfully you will redirect the user to home (or to log in again, or it does not show an error message!

How to manage user profile authentication in getstream.io?

I am a new developer of https://getstream.io/. I am using NodeJS version. I am able to run the example Example, shows feed, activity, notification and profile. Now, I am trying to manage user profile authentication and trying to add a login and registration page with that project but I am unable to do that. Any help is appreciated.
You need to build a back-end application to manage the connection between your front-end and the Stream API.
Then, after creating a user, just get the user's token (using the createUserToken function.
When you create a user, you can pass the password information in the data object and when you create an endpoint for authentication (ie: retrieving the user's token) don't forget to remove this information from the response.
Hope it helps =)

Can I push notifications to Facebook?

I am building a web application using node.js and express.js. I do also use passport.js to authenticate users with Facebook login. I would like to push certain events from my app to the user, so that the user receives a notification at facebook. I am not sure if this is possible or not, is it?
I have tried this, but did not get it to work: https://developers.facebook.com/docs/games/services/appnotifications
I got this error: (#200) Only web canvas apps can send app notifications when trying the endpoint in Postman.
My application do just use the login from facebook, otherwise, it has no other interaction with facebook at the moment.

Resources