Jhipster version 3.2.3 - POST method converted to GET while enabling both HTTP redirect & HTTPS with the 405 error.
"type": "http://www.jhipster.tech/problem/problem-with-message",
"title": "Method Not Allowed",
"status": 405,
"detail": "Request method 'GET' not supported",
"path": "/api/registers",
"message": "error.http.405"
This is normal, when server redirects client through a 302 status code, it's the client's responsibility to handle it and the default behavior is to do a GET on new location which is safe as you may not want to post your data to an unknown URL, so it's up to the angular developer to code a different behavior in the angular service and probably using HttpClient interceptor
Related
Been searching a lot but nothing seems to be working for me,
I'm trying without success to obtain the CSRF Token from a springboot application.
Postman is the chosen APP to try the API Rest.
I am performing a HTTP:POST method invoking a REST API from the application but i am getting this error message:
{
"timestamp": 1956618364439256,
"status": 403,
"error": "Forbidden",
"message": "Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'.",
"path": "/api/rest/taxes"
}
This is my URl:
http://serverser45.swbc.local:9080/api/rest/orders/taxes
Do note that only the HTTP: POST is allowed to be used
I cannot perfom a HTTP: GET method and obtain the CSRF Token within a cookie or something like that. Nothing seems to be working for me.
How can i do that?
I tried get list of event from calendar example from here.
No matter which property I
use, I always get the 404 "not found" error. Anyone can shed some light on this? Many thanks.
Request.
POST https://www.googleapis.com/calendar/v3/calendars/oneclapp.2021#gmail.com/events?
key=AIzaSyCGRPF0wSSBLndqdUftlbsDH9emHD_S-qg
Accept: "application/json"
Authorization: Bearer ya29.a0ARrdaM9PPHndl040qaXFmoSFGT9yRPWZs_yrTnYLAHQ0GF-UBvGc67S2L1m0O5OFIilq8oVGRuvw29NFwomtmUTBeHoABcIlaVD_p--4NVlBWCcXLBgfDjsF_5tvt4XRShd1itpe_9CULan9x6BV4TOyP__TkQ
Response
Response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "not Found",
"message": "Not Found"
}
],
"code": 404,
"message": "Not Found"
}
}
First off events.list is not HTTP Post its a HTTP GET
GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events
Second assuming that you just miss wrote post and you are actually doing a http get.
Not found means just that the currently authenticated user does not have access to the calendar that you are trying to request events for. in this case oneclapp.2021#gmail.com
I recommend using primary to test that you can get the currently authenticated users primary calendar.
GET https://www.googleapis.com/calendar/v3/calendars/primary/events
It looks like you have not configured the OAuth 2.0 Client IDs correctly. We need to configure the OAuth client ID correctly and its type should be 'Web Application'. I was also getting the same error messages, but once I configured the OAuth ID, then it started working.
OAuth id type: Web Application
Permission scopes : https://www.googleapis.com/auth/calendar.readonly, https://www.googleapis.com/auth/calendar, https://www.googleapis.com/auth/calendar.events.readonly, https://www.googleapis.com/auth/calendar.events
Authorized redirect URIs: http://localhost
Here is the screenshot of the Google Calendar API project settings.
I have the following setup: an authentication service (which uses JWT), a Zuul API gateway and a QR code service. Whenever I test the follow flow locally:
With username and password as body:
localhost:8762/api/auth-service/auth/
I get the Bearer token and use it to access the QR code service:
I use the text in the body and it's a POST request which returns the QR image.
localhost:8762/api/qr-service/qr-codes/
However, when I try this in my staging environment in Portainer I get the following:
{
"timestamp": "2020-12-07T13:16:59.188+00:00",
"status": 405,
"error": "Method Not Allowed",
"message": "",
"path": "/qr-codes/"
}
Somehow, by the time it gets to the QR service, it has changed to a GET request since the output logs show this:
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]
Anyone know how to resolve this?
I forgot to add https:// to the staging environment request.
I am using the google-api-ruby-client v0.7.1, ruby 2.1.
When I upload Custom Data Sources through Google Analytics API v3 with Google Analytics API v3 > analytics.management.dailyUploads.upload :
Request
POST https: //www.googleapis.com/analytics/v3/management/accounts/**********************/webproperties/**********************/customDataSources/**********************/dailyUploads/2014-04-06/uploads?appendNumber=1&type=cost&key={YOUR_API_KEY}
Authorization: Bearer **************************
X-JavaScript-User-Agent: Google APIs Explorer
Response
400 Bad Request
{
"error": {
"errors": [{"domain": "global",
"reason": "badRequest",
"message": "Upload request url should start with https://www.googleapis.com/upload/analytics/..."}],
"code": 400,
"message": "Upload request url should start with https://www.googleapis.com/upload/analytics/..."
}
}
That response I get when call this method of api from gem google-api-ruby-client too.
But the documentation states:
HTTP request
POST https: //www.googleapis.com/upload/analytics/v3/management/accounts...
But in Google APIs Explorer and gem request is https: //www.googleapis.com/analytics/v3... , not https://www.googleapis.com/upload/analytics/v3... .
Anyone encountered this problem and how to fix it?
You need to change
user and code value
In authorize method.
You'll get,
user_ID from client_secret.json
and
run the URL, you get in the console under 'Open the following URL in the browser' for code value
When I would do a REST call form my javascript client to the server via domain.com\api\docs\bobs_address
Is it possible to intercept the http post at the server endpoint that means inside my web api controller or does the call of the above url go directly into my Raven database?
Assuming there is a document with an id of "bobs_address", RavenDB will respond with the contents of that document and an HTTP 200 OK response code:
HTTP/1.1 200 OK
{
"FirstName": "Bob",
"LastName": "Smith",
"Address": "5 Elm St."
}
If the URL specified does not point to a valid document, RavenDB follows HTTP conventions and responds with:
HTTP/1.1 404 Not Found
In RavenDB 3.0, we are using OWIN as our middleware, and you can intercept the requests before/after they arrive to RavenDB.
However, what do you want to do with them once you intercepted them?