How to Test Facebook Connect Locally with Monaca - angularjs

I am currently working into a project with AngularJS and OnsenUi in Monaca Localkit and i need your help with the integration of facebook login to the application.
I followed the instructions
here but i didn't make it to work.
On Site URL field i use the http://localhost/
Although, i achieved the desired result with plain javascript and serving my index.html from http://localhost:8080. (of course i changed the Site URL to http://localhost:8080)

Related

Confusion of which Azure AD app Authentication platform redirect configuration to use

I am utterly confused about which platform configurations to use under Azure AD app's Authentication blade.
There are 2 platform configurations I am confused about:
"Web"
"Single-page application"
The app I have registered is a React JS app, which in my mind, is both a Web app AND a SPA.
This "rabbit hole" get's deeper as I'm trying to configure redirect URIs so i can use MSAL.js to authenticate and authorize within the app.
Essentially, it comes down to this (for my http://localhost:5000 development environment):
If I specify my URI under Web, then I get error:
AADSTS9002326: Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type.
And from what ive been reading, Web platform is the way to go (not SPA).
Can somebody shed any light onto this convoluted area?
Which platform configuration should I be using for a ReactJS app?
Thank you.
• React js is mostly used to develop SPA (single page application) as it is a web application or website that interacts with the web browser by dynamically rewriting the current web page with new data from the web server, instead of the default method of the browser loading entire new pages. This means that the URL of your website will not change completely (page will not reload), instead it will keep getting content and rewriting the DOM with it instead of loading a new page. The goal is faster transitions that make the website feel more like a native app.
• When building you react-app, you can see that there is only one App.js from where your entire web-app is loaded in fragments and components. This behaviour of rendering components and pages on a single page and changing the DOM (is a single page behaviour and hence the name), instead of loading a new page with new content, this makes it feel like a single application.
• So, when you are using react js as a building code platform, I would suggest you use SPA as the platform in Azure AD app registration. That does not mean you cannot use react js to create an app on a remote web server and deploy it, you can but for hosting react js coded application script and running it as a worker process and provide a desirable output you need script execution backend runtime like ‘ngrok’ and ‘node.js’ to supplement the execution and provide compatibility with the web server environment.
Please refer below links for more information: -
Why is React Js called as Single Page Application
https://learn.microsoft.com/en-us/answers/questions/315313/azure-app-registration-causing-the-following-error.html

How to configure Wordpress as headless CMS with Next.js

I have a WordPress application in htdocs folder in Xampp and a separated Next.js application running in localhost:3000.
Usually WordPress takes a theme installed and you can navigate the site at http://yourdomain.com. On the other hand the admin UI can be accessed from http://yourdomain.com/wp-admin.
My question is the following, how can I replace the twentytwentyone theme with my Next.js application that uses GraphQL to request data from WordPress endpoint and make it as a root path, in other words http://yourdomain.com must load the Next.js application but also http://yourdomain.com/wp-admin must be the WordPress admin UI. (Without a theme).
If this isn't the ideal thing to do, and both WordPress and Next.js application should be deployed separately, how can I use WordPress only for admin UI and cancel any other rendering that's coming from WordPress, like the default page that uses twentytwentyone theme and make WordPress only as an API endpoint ?
Thanks in advance.
I have completed a similar thing.
The easiest way I found to achieve this was to install wordpress on a subdomain.
http://admin.yourdomain.com
I then ran the next application on
http://yourdomain.com
This way your next application can pull information from the wordpress API at http://admin.yourdomain.com
and you can redirect the home page of the wordpress application to http://admin.yourdomain.com to http://admin.yourdomain.com/wp-admin
This means anyone accessing the wordpress site will be automatically redirected to the admin login, whilst the wordpress API can function normally.

Google crawler verification with Prerender not working

I have setup Prerender.io for SEO of my one of my Angular based project. It's hosted on EC2 Instance running on Apache2 server.
Problem is, when I am doing Fetch or Fetch and Render on Google Webmaster, it not showing expected result.
Case1: If I am checking
http://mywebsite/something
It is fetching just index.html file
Case2: If I am checking
http://mywebsite/?_escaped_fragment_=/something
It is showing this:
Is there a way to verify and to show that crawler is actually crawling my website content or not. Specifically which content crawler actually getting.

How do I call an API in another project but same solution without hard-coding the url?

I have two projects. One for my front-end angular code. Another for Web API. When I'm in the front-end project, I want to make a call to an API in my other project.
The Web API tutorials I have seen show a relative url involving /api such as this:
$http.get("/api/trivia")
That works great if the javascript is in the same project as Web API, but it's not for my Solution.
I can hard-code the url to my API's localhost port and it works fine, but of course that won't work when I deploy the app to Azure. How should I be handling these urls?
Thank you.
When you make a $http with full url (http://...) it directly look at given address. But when you specify relative path (without http://...) it look at your current site + given relative path url.
So If your api also hosted in same site you can still make the reference as $http.get("/api/trivia") or else as you said if you know where you host your site in Azure you can make it hard code in in your script.

How to configure Azure to always show index.html

I am hosting a web application on Azure - I deployed it yesterday by just copying all the required files into wwwroot.
It sort of works - except that it behaves differently than when it did when I just ran npm start locally (it's an Angular 2 app, with config copied from the 5 min quickstart guide) - when I ran it locally, I could manually enter any URL which was handled by routers and it did load, and on Azure it throws a 404 (also happens when I just refresh any page besides the home page) - I presume that somehow when I ran it locally, it figured out that I always need to load index.html, regardless of the actual URL, and let the router handle everything. How can I replicate this behavior on Azure?
Your Azure WebApp is running on an IIS instance by default.
If you want to handle the Html5 Mode(without the hashbang) then you have to create a Web.Config file and define a rewrite.
See How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode?
Dont forget to set <base href="/"> in the <head> of your index.html. Otherwise it wont work.
I think you will probably have to use URL Rewrite for this, unless you are using MVC to deliver the page. Here is a previous answer that will help you configure URL Rewrite. It is talking about WordPress, but it should point you in the right direction.
You should try checking the Azure portal under the Application Settings for the Web Application if .index.html is included in the List of Default Document option
I would be glad if you can rephrase your Question to understand it more.

Resources