Posts

Showing posts with the label authentication

Conditional Routing - Async

Image
Clash Royale CLAN TAG #URR8PPP Conditional Routing - Async I wanted to make a GET request to my server to verify if the user is authenticated or not, basically a true or false function. but it ended up being more complicated than that. GET true or false as i need an async , await function in order to get the response from the request i made. SO, thats what i did. but after calling the function inside a regular sync function which is PrivateRoute it only logs that the promise is still pending . async await response request sync PrivateRoute promise pending SO, i tried turning PrivateRoute into an async function. but react refused to render a [object promise] . PrivateRoute async [object promise] ANY IDEA what to do? const isAuthenticated = async () => { try{ let isAuth = await axios.get('/auth') console.log(isAuth.data) if(Object.keys(isAuth.data).length > 0) return true else return false } catch(err) { console.log(err) } } con...

Passing UserName and Password to retrieve a web service with Angular

Image
Clash Royale CLAN TAG #URR8PPP Passing UserName and Password to retrieve a web service with Angular I am currently using Angular, and want to retrieve information from a Web Service, the web service however, makes me manually input a username and passwordas so how would I do this in my Angular Code so that my project can access it? Thanks! Welcome to Stack Overflow! Currently, you question is missing details to be clearly answerable and on-topic here (see help center for more details). Username and password authentication is a wide subject and there are lots of ways of achieving it. I recommend that you do some research about authentication, and get details on the protocol that is expected by your WebService. Secondly, Angularjs tag is to be used for Angular.JS (version 1 of Angular) and Angular tag is to be used for any version since Angular 2 or above. They are quite different, please be specific about this as well. – Pac0 ...