Access web camera - .NET Core Web Application - asp.net-core

Is there a possibility to access a web camera from Razor Page level (.NET Core 2.1 Web Application)?
I am aiming to achieve online QR code scanner. I am almost sure that I can process captured image with ZXing.Net. What I am missing is the video captured from camera (and as the result screenshots with QR codes).

You can only access the camera client-side (given user permission to do so), not server-side. But, if you need the still server-side, it's just a matter of making an AJAX call following to send what you capture client-side back to the server.
For accessing the camera client-side, see: https://developers.google.com/web/fundamentals/media/capturing-images#access_the_camera_interactively

Related

Planting an Iframe as Aura component to show an external system that receives information from Salesforce API using oAuth web server flow

I have built a web app for our sales team.
The web app is currently using oAuth web server flow in order to authenticate with Salesforce.
Everything is working fine when running it on a separate tab.
We recently wanted to add some functionality from within Salesforce specific objects and display information from our web app.
So I've built an aura component displaying an Iframe with the URL from our web app.
Unfortunately, it crashes with a console error
Refused to frame 'https://***.my.salesforce.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".
So I went to Salesforce's login page and indeed, there is a policy header that prevents it from being loaded from within an Iframe.
What is the correct way to authenticate the user with Salesforce in this situation?
Thank you very much
If you are calling a web app inside of an Iframe(Aura component) it would require the Salesforce domain calling it to be whitelisted in the web app.

React SPA app with .net core backend and .net identity

I basically have the same question as what is detailed here: Login redirect with asp.Core 2.0 and React. But that post never got an answer.
I've searched quite a bit and pretty much my problem is also touched on here here: https://github.com/aspnet/JavaScriptServices/issues/1440
I want to create a react front end application, but use .net core for the backend. I've used the .net core template with react redux as my boilerplate. I've also configured the .net identity on my backend. So I can actually use [Authorize] on my api calls and it works. By this I mean that if someone is authenticated the api returns data and if no one is authenticated it returns whatever the default redirect page is. I can confirm this by looking at the response on my chrome debugger and I see that it is showing the html for the register page which I've defaulted my login path to in configureapplicationcookie options.
The boiler plate is setup to serve up pages from the react client folder and uses react router. Therefore, I cannot set up any links to pages on my server. However, I'm able to manually navigate to my server pages for example /Account/Login and successfully login. My api calls through the links on the react front end then seem to work just as I would like.
What I would like to do is:
make calls from my react application to my server api
upon unsuccessful access to any api endpoint, redirect the user/request to my register page on the .net core server
have the user register and/or login and then redirect them to the route they came from through the react application.
Is this possible? Is it advisable?
I understand that you can manage all this on the front end using IdentityServer as detailed here: http://docs.identityserver.io/en/release/quickstarts/7_javascript_client.html. However, if all the infrastructure can be quickly spun up in .net and I can leverage the authentication templates, then I want to experiment with that setup and save time. Plus if this is feasible, why bother doing the setup on the front end using a 3rd party login provider? What am I missing?

Browserless Authentication using the Web API

I am trying to authenticate a user inside a desktop application using the web api. I am not using a browser, I am using straight up GET and PUSH calls to the endpoints of the Spotify servers. Immediately I ran into some problems. It appears that upon the initial GET command to "accounts.spotify.com", the returned response includes HTML with a javascript function that runs and is responsible for dynamically generating HTML that you see on the initial login page. If you look at the Javascript function, it is clear that this is what is going on, however, you can also see this code is obfuscated and not meant to be used by us, the developers! (Link to Javascript code here for reference: Javascript function)
So my question is, while I can probably reverse engineer the code to get this working, would this be against the Spotify developer TOS?
Thanks!
Spotify's authentication happens through oauth, and a big part of user authentication as per the oauth rfc is where the user delegates permissions to your app to carry out API calls that affect their account, or return information about them. That's the web page you're seeing - it must be presented to your users so that they can delegate permissions so that Spotify can give your app an access token. It doesn't necessarily need to happen in a browser - it can happen in a web view inside your desktop application - but it does need to be loaded over https, and your application must not alter or reverse engineer the Spotify permissions delegations page.
As you correctly guessed, reverse engineering any Spotify APIs is against terms of service.
For more information on authorization on the Spotify platform, I'd recommend having a look at this guide.
Hope that helps! Please ping me if you have any more questions.
Hugh
Spotify Developer Support

Display Web page inside a mono application

Is there a way to display a web page inside an application done with mono framework. It is a cross platform application, so it would be great if the solution is in mono. It need not be a generic browser, i just need to display the web pages from my own server. The number of pages is too much also it will be updated often, so cannot include it in the app itself.
Any help would be really great. BTW the app will be for most of the mobile platforms, like android and iPhone.

open screen/view (iPhone app)

I have a iOS developer. He is writing he iPhone app.
I am writing the web service that is used by the iPhone app.
The mobile app has many screens (or views what do you call it?)
What response does my web service need to respond with so that the mobile app knows what screen to open. There are many screens, and different screen input parameters.
Note: im not an objective-c developer. So I dont know what my developer wants my web service to respond with.
ASK YOUR DEVELOPER! (and they're called views). Someone developing a web service shouldn't be worried about views, that's definitely a dev issue
It depends on requirement you don't need to do anything with screens(views). This depends on Requirement of the project. What data has o be displayed for a specific screen you need to create functions for that only. The developer will call your web service function and your web service will return response in format of json(I prefer because it's lightweight and fast) or XML. The ios developer will parse the response and display the data on screen. Now it's up to him how he uses your web services. For example assume there is login screen so iphone app will send you user name and password your web service validate the credential and send response as success or failure. I hope you understand.