Authentication in openUI5 how i can do this? - javascript

hello guys I would like to ask for help from you, I am developing my first application using openUI5, this application is already well advanced thanks to the help of the forums here and some research I did. however, I came across a problem in which I don't know how to proceed. in my application it will be necessary to register and login, so i did a search and found q many do this part of login using JWT, then i did the same i did a backend application to make this token available to me, however i don't know how to effectively use it in my project .
I currently have an API running, in ASP.NET, on a machine at AMAZON that when running it I get the token but I don't know what to do exactly with that token if someone can pass me the way of what I will be very grateful.
anyone who can provide me with an example or something in that sense would be very useful

Related

How to call APIs from my JavaScript application

I am a 55 yr old novice to API use who grew up in mainframes, scripting, and Wordpress as far as web hosting goes… and I need help. I am stuck because of my lack of knowledge: I can't figure out how to call an API from my application to make embedded checkout work in a headless store - and I want to learn how.
I've exhausted my Google searches and Youtube videos, but since I don't know what to look for when I find it.
To most this is very likely basic, simple and straightforward, for me it's like I'm sitting in a car and have no idea how to turn the engine on.
What I have/know so far:
How to make embedded checkout work:
https://developer.bigcommerce.com/api-docs/storefronts/embedded-checkout/embedded-checkout-tutorial
and this is where I am lost - I have no idea where to place this code in my vercel & bigcommerce application at
https://github.com/GJB65/commerce1
I humbly acknowledge defeat and would thoroughly appreciate a mentor to help me understand how to turn my embedded checkout engine on.
So the one question I have is "how to call APIs from my application?"
if you're referring to the code on the tutorial as what you're not sure where to place -- These are API requests. To test, you can do make these request via a client (like postman - https://www.postman.com/
) or for most of them, you can make these requests directly on our API reference pages in the Test Request section at the bottom of the page. Like this one here:
https://developer.bigcommerce.com/api-reference/store-management/channels/channels/createchannel
These resources may also be helpful to you in your learning journey!
https://developer.bigcommerce.com/api-docs/storefronts/developers-guide-headless
https://developer.bigcommerce.com/api-docs/storefronts/embedded-checkout/embedded-checkout-overview
https://support.bigcommerce.com/s/article/BigCommerce-for-WordPress-Checkout (if you're using WP as your headless storefront)

Can any one tell me how to use facebook strategy for oauth in node js?

i need my website to have facebook login.Google oauth work fine but the facebook login doesnot work its show some error.I think i had made some mistake while creating app in facebook developer.I find hard to find guide for creating the app in facebook and found some guide but that are old and facebook keep changing the policy for creating app.
So can any one provide me guide to use Facebook-strategy using passport js?
Please revisit: https://stackoverflow.com/help/mcve it's hard/impossible to help you without specific code that isn't working. Remember that stack overflow isn't a forum, it is a wiki.
Now, Passport has strategies, which basically allow you to add different types of authentication to your app. For Facebook, you need to use oAuth2. Since big companies such as Google or Facebook add their own "flavour" to oAuth2, the best thing to do it's to use a specific passport strategy.
This should do the job for you: http://www.passportjs.org/packages/passport-facebook/ follow the documentation and you should be good to go. Sorry for no more in-depth help, but as I said it's hard to help without the specifics of your problem

Loopback4 - How to create JWT auth with roles

Well the title pretty much sums it up. I'm trying to add authentication to my app, but i'm hitting a LOT of errors.
I'm pretty new to nodejs and especially Loopback4 and i get stuck quite a lot.
For testing purposes i tried implementing #loopback/authentication but i'm encountering an error such as The key controller.current.ctor was not bound to any value.
I followed the tutorial to the letter and quadruple checked my code to make sure everything is fine. Where others say it works, for me it doesnt.
Either way, that was just as a test implementation. I'm trying to find a way to implement a better authentication which should look for user roles as well.
Lets say i want to create a blog api with loopback and i needs POSTS to be accessed by this -> Users who are authors. Users who have the role admin, moderator, etc and to restrict access to unauthenticated users.
LB4 documentation is pretty small and since i'm new to this i'm literally stuck. Any help, snippets, etc would be highly appreciated!
P.S: I'm using MySQL as my DB.

Confusion regarding implementation of token based authentication [Node js Express js]

After all the research on authentication methods related to nodejs and express js, I am standing in no man's land.
By far the easiest session related tutorial I have come across is this.
https://codeforgeek.com/2014/09/manage-session-using-node-js-express-4/
I am using mean stack and this is what I really want to do. The user when logins will get an authentication token that will be saved on the client side and then before every page reload a call will be made to the server to check if the user is authenticated or not.
Here comes the tricky part.
I am using the server to work for Computer - that is angular based system and cellphone which is based on android - an android application.
In short that means a user may login using his computer and cellphone as well (using the application) at the same time.
How to implement this is still a mystery for me. Please direct me to some tutorials or gits which will explain this things in simplest possible means.
Please don't respond with passport js only because I have failed to find anything meaningful there, or maybe it is possible that I am looking at the wrong place.
I am new to all this that is way this problematic.
Thanks for your help.
The most reliable way to implement the token based authentication is to use oAuth2.0 which also involve use of passport JS
Here , use this example as a reference point for implementing the token based authorization
http://scottksmith.com/blog/2014/07/02/beer-locker-building-a-restful-api-with-node-oauth2-server/
This sample code have fully functional OAuth2 server done with just a little bit of work. it uses OAuth2orize library that makes building server very straightfoward.
As you have mentioned that you are using Angular and NodeJS and want to implement Token Based Authentication.
I would suggest you use Satellizer.
Also you can find NodeJS implementation over here:
NodeJS Example.
My answer is for all the beginners out there. I read something similar in facebook's node js group and I think the problem I am facing is not unique.
The passport js which is very famous just works as a middle ware and if you have to include options like google authentication, facebook authentication etc. this is very useful as most of the work is already done and your middleware work is handled by this module.
But if like me you are searching for something simple and all you want is a proper authentication system with database then this might not be necessary, this = passport js module.
You are surely depending on one more module which is complex as well, if you want to implement token based authentication. In the end if you are handling all the authentication work in the middle by yourself, why should you use a module as well which increases complexity in the end.
I even took suggestion from other node js developers who have worked on this for good amount of time and they think it is okay to head without passport js if you are ready to work with middleware yourself and you don't need fb etc. authentication.
I hope this will help others who are new to all this.
Since the question referred to my article directly. Here is the token based implementation using Node.js as the answer.
https://codeforgeek.com/2016/08/token-based-authentication-using-nodejs-rethinkdb/
Hope it helps.

How to secure Node.js connect-rest REST API with OAuth?

I tried Googling around for some examples, or well anything, but couldn't find any results. I think partially because the name of the package "connect-rest" is so generic.
Anyway, here is what i'm looking to do. I am using the Node module "connect-rest" to build a server side API. It is mostly finished at this point, and i'm now looking to secure it. Now the module itself has a system of authentication with API Keys, which is well and fine, but not very secure for Javascript clients, since anyone could just browse the source and grab the key. And trying to secure a key -- well it just doesn't work without getting super complicated.
So instead i'd rather use a standard OAuth setup. I was hoping to use Passport in combination with connect-rest and wondering if anyone has done this before or point me to some examples?
I found exactly what I needed with OAuthorize: https://github.com/jaredhanson/oauthorize which is written by the same guy as Passport.
We used the following guide for our own learning when we started a similar process: http://scotch.io/tutorials/javascript/easy-node-authentication-setup-and-local
Also take a look at MeanJS. It has a built in authentication/user system.

Categories

Resources