I have a website which has a MySQL database and users are able to login to website using social media. Website allows its users to create their own quotes and list them on the website.
I am creating a mobile app for this website using Flutter. I am using Firebase Authentication for social login (Google and Facebook).
What I want to do now is fetch those quotes which user created on website and show on app and also push his quotes which he created in app to the website so that there is a sync of user data.
I've tried looking on internet but I can't seem to figure out how to achieve this.
I thought of two ways:
1) New users registered in Firebase, which are not in the website's database gets inserted in website's MySQL --> I don't know how to do this.
2) I leave Firebase as it is and just hit MySQL with this email which i get during Firebase authentication and fetch/push those quotes but this problem might lead to some sync issues.
Related
I am currently using JSON Web Token to authenticate every page of my website except homepage. The idea is to generate token on login/registration with the user's MongoDB id and save that into cookies. Then whenever user tries to open any page, first token will be decoded and then id will be matched with the database records to verify that the correct user is trying to access page.
I haven't launched the website yet. My question is, is it a good practice to access database before every page loads for user or will it slow down my website once more users start coming on website?
I've searched and I can only find tutorials to pull info from a server to update the latest info of my PWA app using JSON. But I can't find any way and any example to fetch data back to a server to mantain for instance a Database updated and display that to all users which may use that PWA.
For example, I have a PWA that let me login (client-server communication), then it displays a list of contacts that were stored in a Database. I can delete, modify or add new users to this list from my PWA app, and after doing that, they'll update on my server Database, so if my friend Paul, wants to check the updated list from his account, he'll see the new changes.
How Can I do that? Which language would I have to use, php and Javascript (Ajax)? Which is the most fluid and optimized way to do it according to a Progressive Web App.
I guess you are trying to store user changes back to the server(webservice and then to the data base).
You have to make an AJAX call to your web service and pass the required data needed to store in DB.
Here is an example.
https://www.w3schools.com/xml/xml_http.asp
Depending on the framework you are using, you might have more options to call a web service. Like here is an example for Angular -> https://www.w3schools.com/angular/angular_http.asp
I am trying to retrieve the data from a website after the script successfully logs in. I am able to fetch the data from the website but it seems it just giving me the information from the website prior to the website of the login. Any help would be really appreciated
If you are trying to create a software to fetch data of a site after login, you might have to handle sessions and cookies as that's how a site knows a user if logged in or not.
I have three websites: a.example.com, b.example.com, and c.net. Each was built a couple years after the other and all have their own users table.
I want to integrate these sites together so that I can login with a single username/password combo and have access to all three sites just by clicking links without having to login again.
I've never done an integration like this before, so looking at two angles:
1) Create another website, 'd.net' where new accounts can be created. If you login to one of the original three sites, it asks you for your d.net account. If you dont have one it asks you to make one. In your 'account settings' on d.net, you can 'add sites' to your account by entering your old username and password for them. Sound reasonable?
2) Solving the technical problem of being able to one-click login to another of the three sites if i'm already logged into d.net. Afaik, cookies with a session ID can't be shared across domains. So... maybe generate a token and save it to the database. Send token over GET to another website, which can check the token, log the user in, and then delete the token. Sound about right?
Have you looked at OpenID?
http://en.wikipedia.org/wiki/OpenID
Don't have to re-invent the wheel.
What is the right way to connect to database from an iphone app? I built a website and now I want to biild an app that can enter and veiw information from the database, like autotrader and rightmove how they get the same information on the website in the iphone app?
You need to create a REST API (PHP) fetch & update data from the centralized Mysql DB.
You can call this through NSURLConnection. Your REST API returns XML or JSON.from you coding u can write coding to parse.