Discrepency with Jenkins Crumb value - jenkins

I am using Postman API to create new job in Jenkins.Inside Postman UI,with GET request the Jenkins-crumb I am getting gives me proper output i.e.Status 200 Ok when passed into POST request.
But when I am hitting same URL(used in GET request) outside Postman UI, the crumb value that I get gives me "403 NO valid crumb included in request".
How we can solve this issue?

Mostly its due to the security constraints in Jenkins https://jenkins.io/doc/upgrade-guide/2.176/
To fix, you might use options specified in this answer https://stackoverflow.com/a/59261140/374133
I had same issue while using C#, and it got solved by using the same HttpClient for requesting crumb and triggering build. Got the idea from this answer : https://stackoverflow.com/a/63103522/374133

Related

CAS Access Token Not Supported in 6.5.2

I am using CAS-Server as my oAuth server and did all the configuration as mentioned in the documentation.
But when I try to hit the postman for generating accessToken I am getting the below exception.
2022-04-28 22:11:58,625 ERROR [org.apereo.cas.support.oauth.web.endpoints.OAuth20AccessTokenEndpointController] -
java.lang.UnsupportedOperationException: Access token request is not supported
at org.apereo.cas.support.oauth.web.endpoints.OAuth20AccessTokenEndpointController.lambda$verifyAccessTokenRequest$2(OAuth20AccessTokenEndpointController.java:187) ~[cas-server-support-oauth-core-api-6.5.3.jar!/:6.5.3]
Please help me to resolve this error.
I got same error when I hit 'POST /oidc/accessToken' without passing correct parameters. It works after I pass correct parameters. Try this:
Parameters for /oidc/accessToken

OAuth Error 400: invalid_request Missing scheme: /login

I am trying to use OAuth in my app and I am getting the following error after clicking the login button to be redirected to the generated url.
However, I am getting the following error but I'm pretty sure that I have my URI's configured correctly in the developers console (image below).
Also, I am not finding the same error while searching. Has anyone else encountered this?
I am pretty sure that I have the /login scheme configured correctly as so.
It's worth mentioning that I am following a tutorial series and this is exactly what they recommended. That's another reason I'm pretty confused.
Thanks for any help in advance.
I discovered the issue - I was passing an invalid URL into the options of google.auth.OAuth2( ... )
I failed to realize this because my URL was coming from .env file.

AWS API Gateway {"error": "missing authentication token"}

I've been constantly getting the "missing authentication token" error when I click the AWS API gateway POST method url through the browser. I set "AUTH" as none and it's working totally fine through Postman but not with the browser. The problem is that I'm using swift to trigger the method and it doesn't seem to be reaching the gateway at all (no log on CloudWatch) and I don't think my code is wrong (or maybe it is). If someone could point out what my mistake is or a solution to this problem I'd appreciate it so much.
P.S. My lambda function is working totally fine and I typed in the right URL (one in the code is just for example)
Here's my code:
func postNonceToServer(paymentMethodNonce: String) {
let paymentURL = URL(string: "https://example-url.us-east-1.amazonaws.com/prod/create-transaction")!
var request = URLRequest(url: paymentURL)
request.httpBody = "\(paymentMethodNonce)".data(using: String.Encoding.utf8)
request.httpMethod = "POST"
}
In my opinion, this should be a problem in the URL itself. I can think of:
1- Please make sure that the URL is parsed correctly by printing it to the console and pasting it into the browser URL bar. (I have no idea about swift)
2- Make sure that "execute-api" is included in your "example-url", i.e., before the region.
3- Make sure that OPTIONS method has AUTH as none.
Good luck!
After enabling CORS on my endpoints I was receiving the same error message:
{"message":"Missing Authentication Token"}
Everything checked out, but I consistently received that error. To fix my issue I had to deploy the API. To do that, do the following:
Go to "Amazon API Gateway" console
Click on the API Gateway in question
Click "Resources" and select the root resource, e.g., "/"
Click "Actions" and then "Deploy API"
Select the stage you want to deploy to
Click "Deploy"
Long story short, redeploy the API after you've enabled CORS.
This mostly would be because of CORS issue.
Please enable CORS in you API gateway like below. After enabling CORS please redeploy the API
If you don't have OPTIONS added, please follow below steps (If OPTIONS already there just add CORS),
Create a new OPTIONS method under the /services resource
Create and populate the Access-Control-Allow-Origin/Method/Headers in the OPTIONS method.
Enable CORS like below after creating OPTIONS

Dockerhub Create Automated Build step stuck at Creating

I used this link (create an Automated Build) from this guide.
The browser error console shows:
https://hub.docker.com/v2/repositories/github//autobuild/
Failed to load resource: the server responded with a status of 403 (FORBIDDEN)
I got this hint from https://github.com/docker/hub-feedback/issues/411#issuecomment-149878749
I replaced the following URL with my values.
https://hub.docker.com/add/automated-build/github/form/<GITHUB USER ID>/<GITHUB REPO NAME>/?namespace=<DOCKERHUB NAMESPACE>
This workaround has been outdated.
The url returns a 404.
Imho, this has to do with dockerhub changing some policies, concerning 'classic' autobuilds & company/user setup.

How to determine that caught LibGit2SharpException is the HTTP 401 error?

When I try to fetch changes (RepositoryExtensions.Fetch) using invalid credentials LibGit2Sharp throws LibGit2SharpException with the following message:
An error was raised by libgit2. Category = Tag (Error).
Request failed with status code: 401
Since there might be other errors is there any way to determine that the exception is in fact HTTP 401 error without parsing the message?
Unfortunately, I don't think it is currently possible to get more specific information from that exception. This is something that would be a useful addition. Would you want to open an issue on the LibGit2Sharp project for this? If not, I will create one shortly.

Resources