Getting Error400 when signing into Strapi admin panel - reactjs

I have a strapi cms which I use for fetching. Today I ran npm run develop to start the server, and it needed be to login. No big deal, I logged in with my credentials, and it says wrong credentials. I tried the 3 passwords I use, but none of them work. I clicked "forgot password" and waited for the password reset, but it never came. I went back to sign in again, and I notice this message whenever I click the sign in button:
POSThttp://localhost:1337/admin/login [HTTP/1.1 400 Bad Request 95ms]
This message is also displayed in my IDE's console:
debug POST /admin/login (89 ms) 400
I've been trying to login for the past hour but it's still not letting me. I've already restarted the server, the IDE, my computer, as well as clearing cache and cookies, but none of them worked. Any clue to solve this?
Update:
This message is appearing in the console. I wonder if it's relevant? It's weird though because I never modified with the scripts in my IDE.
DevTools failed to load SourceMap: Could not parse content for http://localhost:1337/admin/shallowequal.cjs.production.min.js.map: Unexpected token < in JSON at position 0

Related

Missing or incorrect CSRF cookie type

I am using cakephp 4.1 and also xero api. When the user logs in xero is connected . Sometimes this error appears below. My questions is that how do i prevent this and why is this happening? "The problem is this: If a user has the login page tab several days opened in the browser then the cookie expires and this leads to this exception". This is incorrect as i can leave login page open for days and not get this error. I can't reproduce it . How do i detect this error and ow do i fix it. I thought the answer to the post does not solve my problem
Catch "Missing or incorrect CSRF cookie type." exception
Yes you are correct it should not happen, the way you can reproduce is by manually modifying the cookies from the browser dev tools.
Steps to do that (Chrome)
Open dev tools (Right-click and click on inspector)
Open Application tab
Switch to cookies (Choose the domain for which you are setting the cookies)
Change the expires field (to past date).

Using AWS-Amplify with Firefox

I hope you are all doing good,
I have a question that I've been stuck on for the past couple of days.
I am building a website with React that uses AWS-Amplify for user authentications (For users on the Cognito AWS database).
I am working on the Log-in and Sign-up page, and it's working fine when using Chrome, but whenever I am using Firefox there is an issue (Specifically the Log-in).
Problem: There is a part in the JS code that uses the Auth.signin() function from the aws-amplify extension. This function takes in the username and password and returns if the user is authenticated or not. However, when using Firefox, this function gets timed-out, as if the browser can't get the response from the server. Here is a screenshot of the console:
Seems like the response is 403 but I am guessing it's because of the time-out.
(The try/catch doesn't catch anything because it looks as if the page freezes)
I hope I made it clear, and thank you for your time reading everything!
Do your request headers/body contain the correct username and password for the user in Firefox, and is it sending the request to the same endpoint as in Chrome? The 403 code makes me think that the endpoint is malformed on the Firefox request. Finally, is it sending with SRP_AUTH or USER_PASSWORD_AUTH?
Also, since you're using React with Cognito+Amplify for auth*, you might want to consider using the withAuthenticator higher-order-component provided by aws-amplify-react and styling it to your needs. Then you won't need to maintain your own login logic, won't need to worry about fixing it yourself if a browser change breaks your code, etc.

Siteminder: 'Unable to process SMSESSION cookie' for only GET requests

I have integrated siteminder with my spring application which runs on Tomcat and the front end is developed on AngularJS.
The problem is that after 20 minutes of logging in I am getting error in webagent.log saying 'Unable to process SMSESSION cookie'.
Interesting point is that it is happening only for GET requests and apache is throwing 302 for these requests, trying to redirect to SSO login page.
However, for POST requests, I am getting 200 with proper response.
When user is redirected to SSO login page, SSO again redirects to the application without asking to enter login credentials again. And again application works fine for next 20 minutes until GET requests starts failing again.
Does anyone know root-cause/solution of this issue?
Thanks.
Do you have different rules created for GET and POST requests.. What is the idle and maximum timeout value set for the rules.
If you are in a position to enable debug on the webagent, that will tell you exactly why the request is being rejected although from the sound of it, it seems to be an obvious case of session timing out.

Google API app engine redirect uri

can someone point me in the right direction re: redirect uri
right now i have app hosted on appspot (nothing done or uploaded to it at this point)
"Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this error message and the query that caused it."
do i need to upload anything for this to work?
https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi
POST /o/oauth2/token HTTP/1.1
Host: accounts.google.com
Content-Type: application/x-www-form-urlencoded
code=4/v6xr77ewYqhvHSyW6UJ1w7jKwAzu&
client_id=8819981768.apps.googleusercontent.com&
client_secret={client_secret}&
redirect_uri=https://oauth2-login-demo.appspot.com/code&
grant_type=authorization_code
i just want to authenticate so that i can use the calendar api
Do upload the application. I am not sure what you mean by saying that the app is hosted on appspot but nothing done or uploaded at this point. So, first make sure that you have uploaded a version of your application.
The OAuth process is redirecting the flow if I understand correct to oauth2-login-demo.appspot.com and you must have registered this callback url when setting up your application.
So it seems that the redirection is probably taking place but you are seeing the General Exception that is normally thrown by App Engine.
You should look into the Admin Console -> Logs for your application to understand the reason for the failure. You might get some information there about the cause.
If there is a problem with your code, it will point that in the logs. Alternately, put in some exception handlers and bump up the Log Level to INFO in your logging.properties to have a better chance of tracking down the root case.

GET request not firing in IE

This is killing me.
So I have a backbone site where when the user logs in, a GET request is made to the server and an access token is returned. Everything is working in FF, Chrome, IE10.
When I look at code inspector in IE9, the network tab does not list the get request to my API at all (not even as pending or failed). When I console log "error.status or error.statusText", it returns with:
0 Error: Access is denied.
My API has "Access-Control-Allow-Origin: *" enabled. I have also added "jQuery.support.cors = true;" to my initialize function in router.js. Now I am just out of ideas! I would really prefer not to setup a proxy.
if you are using backbone than probably you are using jQuery too, so i think you should check this post : Simple jQuery post not working on Internet Explorer 9 (access denied)

Resources