Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

401 Unauthorized error with correct credentials.

Đang mở
#63 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
api, authentication

Hướng nghiên cứu

Bắt đầu bằng cách so sánh các thuộc tính trong getMyMerchantDetails() với ví dụ getMerchantDetails() đang hoạt động, tập trung vào ID người bán, ID khóa, khóa bí mật, loại xác thực và môi trường chạy. Tái tạo yêu cầu tới https://apitest.cybersource.com/pts/v2/payments và xác minh rằng cấu hình đã sửa trả về phản hồi 201 như mong đợi thay vì 401 Unauthorized.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I followed the documentation and set up my API credentials as below:

public static Properties getMyMerchantDetails() {
		Properties props = new Properties();

		// HTTP_Signature = http_signature and JWT = jwt
		props.setProperty("authenticationType", "http_signature");
		props.setProperty("merchantID", "my_web_au");
		props.setProperty("runEnvironment", "apitest.cybersource.com");
		
		props.setProperty("merchantKeyId", "my_merchant_id");
		props.setProperty("merchantsecretKey", "my_sercret_key");
		props.setProperty("useMetaKey", "false");
		props.setProperty("enableClientCert", "false");

		return props;

	}

it gives me 401 unauthorized error:
Response{protocol=http/1.1, code=401, message=Unauthorized, url=https://apitest.cybersource.com/pts/v2/payments}

public static Properties getMerchantDetails() {
		Properties props = new Properties();

		// HTTP_Signature = http_signature and JWT = jwt
		props.setProperty("authenticationType", "http_signature");
		props.setProperty("merchantID", "testrest");
		props.setProperty("runEnvironment", "apitest.cybersource.com");
		props.setProperty("requestJsonPath", "src/main/resources/request.json");

		props.setProperty("useMetaKey", "false");

		// HTTP Parameters
		props.setProperty("merchantKeyId", "ggggggggggg");
		props.setProperty("merchantsecretKey", "gggggggggg");
		props.setProperty("enableClientCert", "false");
	
		return props;

	}

The above gives which is me 201 proper response.

I am sure my credentials are correctly created. Is there anything else I should add or modify to get past authorization?

Ngôn ngữ chính
Java
Star
35
Fork
84
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CyberSource/cybersource-rest-samples-java

Tất cả issue của CyberSource/cybersource-rest-samples-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.