AdalJs acquireToken fails with invalid state error - reactjs

My adaljs code to fetch a token for a web api is suddenly failing. This has been working for months now. Since yesterday, I get the following error.
Invalid_state. state: 7ea40a81-5491-47a1-8ebc-89488acb673a|https://sykesenterprises.onmicrosoft.com/MyAPI
This happens when the acquireToken method is called.
I am using the example from https://blog.mastykarz.nl/building-office-365-web-applications-react/ to use react with adaljs.

Managed to sort this out. If anyone else has the same issue, the answer was to just call adal.handleWindowCallback() at the entry point to the application.

The issue occurs because the sample you are referring to needs to be updated as per the latest version of Adal 1.0.16. I was able to fork the repo and submit a pull request to the owner to fix the invalid_state issue. Please refer to the link below to see the code changes:
https://github.com/waldekmastykarz/office-mygroups-react/pull/3/files

Related

Stripe `AddressElement` is undefined

I am using stripe to receive payments and I am following this guide to get the address of the my buyers, but the guide seems to be wrong wrong:
when importing import {AddressElement} from '#stripe/react-stripe-js';, the library doesnt seem to have the AddressElement anywhere in there (I also searched manually for it) and AddressElement is undefined
Do you any idea if the guide is actually wrong?
Instead of using
AddressElement
Stripe now provides a
BillingAddressFields
component that you can use to collect a customer's billing address.
The problem was easy to solve - I had an older version of #stripe/react-stripe-js. Installing the latest one solved the issue

httpbin.org/get request keep on called in Reacts application

Can any one explain why a get request kept on called in Reacts application. Refer the below image.
I found out the solution, I was using a npm package "react-detect-offline" to render components based on online and offline status, that was triggering a request to check the same.
if possible could you please expand upon your question a little more, like maybe an example of your code that's making the request?
(I don't have enough rep to post comments)

Debugging Firebase Authentication in react

My sign in with firebase authentication completes successfully. I am using signInWithPopup. It returns a blank screen but does not break the flow. However after logging in, a message appears in my console. The message is :
A boolean is being passed as a fourth parameter to window.open. This is not used and may cause an exception in a future release.
How do I handle this exception?
The second part of the question is what data in response(that we get in promise from firebase sign in with popup) correlates with the above mentioned exception? Is it a completely different problem or does it have anything to do with the blank popup? Thank you in advance. If more information is needed to solve the problem, kindly say so.
This may be a newly introduced bug with Firebase and one of its dependencies. I suggest rolling Firebase to a previous and consistent version for Firebase and its sister modules
Source:
https://github.com/firebase/firebase-js-sdk/issues/4988

Why am I getting Not Found Error in MERN Stack

i am having a problem connecting to backend
whenever i click submit button, i am getting a 404 error. clicking submit button must redirect to localhost:5000/posts
i am getting the error from 3 sites from my client side:
https://github.com/Yokubjon-J/posts-mern-stack/blob/master/client/src/api/index.js#L5
https://github.com/Yokubjon-J/posts-mern-stack/blob/master/client/src/actions/posts.js#L17
https://github.com/Yokubjon-J/posts-mern-stack/blob/master/client/src/components/Form/Form.js#L17
any suggestions?
i even included proxy in package.json file but it wasn't helpful
Due to the help from online community, I realized that the mistake was in server/routers/post.js file where i typed router.get('/', createPost);, i changed it to router.post('/', createPost); and my problem was solved by it.
A helpful comment by a member of online community:
If you get 404 with an endpoint that should exists, usually it means you've either used the wrong method - eg get instead of post - or you haven't connected your router to your app. (If other end points work for the router then it's unlikely the latter.)

when using feathers express, it gives page not found error #2355

I'm intergrating feathers js both on backend and frontend and I got page not found error when I tried this implementation. I would appreciate your help. thanks for the awesome work!
code
https://github.com/react-boilerplate/react-boilerplate/issues/2355
This is the same problem discussed in this FAQ.
Just like in Express itself, the order of middleware matters. If you
registered a custom middleware outside of the generator, you have to
make sure that it runs before the notFound() error midlleware.
This means that
app.use(express.notFound());
Always has to be the last app.use call.

Resources