How do I create a PHP WebApi secured with NetworkCredentals? - php

I have a PHP WebApi. The client is using ASP.Net. The client set the standart that my PHP WebApi must secured with Basic Authentication. But the client request my PHP WebApi with NetworkCredentials. When I set the Basic auth with IIS or PHP the client couldn't access my WebApi.
My question is how can I set the Basic auth which is using NetworkCredentials?
I'm asking to equvalent of it on PHP.

Related

Authenticate with PHP and interact with JS in Firebase

I am having a PHP based application, that uses MySQL as the DB. I am currently trying to build a real-time messaging system for the users in the application. I have found Firebase to be a very good solution for building this. However, I am not sure if the architecture I am planning is compatible with the architecture am planning. Digging through the documentation didn't really get me the answers.
My Doubts are:
I don't want users to again login to use chat, so I want to
authenticated via the server (i.e from php).
I want, the further chat/messaging to happen from client to Firebase directly as I don't want to have unwanted overhead on my server, especially when a direct connection is not only supported but also efficient.
Can I authenticate via php and get some secret key or something and then use that to connect securely via Js?
I found this link which talks about custom authentication system. But am not sure, if this is what I have to use. And if the solution am planning is scalable and ok.
Firebase Auth persists the session on the client via localStorage/indexedDB and is a headless API that doesn't require a hosted server. So you are not required to authenticate the user via your server.
You can definitely build the messaging app entirely on the client with real-time database without routing traffic to your server. Here is an example of a chat app built with Firebase: https://github.com/firebase/friendlychat
If you already have an existing authentication system, you can use custom auth which requires that you mint a custom token after you authenticate a user with your system, you then send that custom token to the client and then signInWithCustomToken. Here is some code to create a custom token with PHP: https://firebase.google.com/docs/auth/admin/create-custom-tokens#create_custom_tokens_using_the_firebase_admin_sdk
If you don't have an existing auth system, you can entirely run the authentication on the client side. Another good library for authentication that is built on top of Firebase is FirebaseUI: https://github.com/firebase/firebaseui-web

PHP NodeJS authentification

I would like my PHP based page (directory.domain.com) to use my NodeJS server to authenticate (api.domain.com). I have implemented passportjs on the NodeJS server for authentication.
I would like to authenticate the user through the NodeJS server when submitting a login form on directory.domain.com and create a session whereby the user can make post, get, put calls to the api.
Is this something that is possible? Is it as simple as creating a ajax request to the api and then setting a token?
Yes it is possible. Maybe the best way of doing this is using JSON Web Token (JWT) for authenticating the user (or the PHP Session) with the NodeJS API. More Info on JWT here: jwt.io.
Under Libraries you also find multiple PHP and NodeJS Libraries to use.

PHP oAuth2 with Angularjs

I am building an application using PHP and AngularJS.Trying to build rest server at the PHP end. For authentication and authorization thinking to use Oauth2. I have gone through their example url : Oauth2 server
But how I can include it into my Application ? Also there any other way to authenticate Angular JS ?

Create webservice using Nusoap that requires authentication on PHP

I have web service server using Nusoap on codeigniter, I wonder how I could add an authentication to it?
thanks

php webservice basic authentication

i am creating web service using NUSOAP i want to add basic authentication to the webservice so that client should send authentication header before he will be able to call webservice function so what will be my server side script my client should send basic authentication server before calling to the hello function I want to Secure my webservice functions
To me, this depends on your webserver. For an apache server for example, see this doc

Categories