Sendgrid email api showing unauthorized error - email

I am trying to send email through SENDGRID API from
https://packagist.org/packages/sendgrid/sendgrid
I am using "Hello Email" code from above link
But when I try to run email this is what I am getting
Array
(
[0] => HTTP/1.1 401 UNAUTHORIZED
[1] => Server: nginx
[2] => Date: Wed, 03 Apr 2019 04:33:59 GMT
[3] => Content-Type: application/json
[4] => Content-Length: 62
[5] => Connection: keep-alive
[6] => Access-Control-Allow-Methods: HEAD, GET, OPTIONS, DELETE
[7] => Access-Control-Max-Age: 21600
[8] => Access-Control-Expose-Headers: Link, Location
[9] => Access-Control-Allow-Origin: *
[10] => Access-Control-Allow-Headers: AUTHORIZATION, Content-Type, On-behalf-of, x-sg-elas-acl, X-Recaptcha, X-Request-Source
[11] => Content-Security-Policy: default-src https://api.sendgrid.com; frame-src 'none'; object-src 'none'
[12] => X-Content-Type-Options: nosniff
[13] => Strict-Transport-Security: max-age=31536000
[14] =>
[15] =>
)
{"errors":[{"field":null,"message":"authorization required"}]}
Even I uploaded on the live server, but still getting same, tried to create 2,3 more API keys with full access but getting the same issue.
Please help me...

Related

Active-Active minio cluster sync data

https://docs.min.io/minio/baremetal/replication/enable-server-side-two-way-bucket-replication.html#required-permissions
I follow this guide, when I do "mc admin policy add". I got an err:
mc: <ERROR> Unable to add new policy: conditions are not supported for action s3:GetBucketVersioning.
Then I add '--debug':
mc: <DEBUG> PUT /minio/admin/v3/add-canned-policy?name=ReplicationRemoteUserPolicy.json HTTP/1.1
Host: xxxxx:xxx
User-Agent: MinIO (linux; amd64) madmin-go/0.0.1 mc/RELEASE.2022-07-06T14-54-36Z
Content-Length: 1328
Accept-Encoding: gzip
Authorization: AWS4-HMAC-SHA256 Credential=admin/20220707//s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: 26a5f72146edcd356b967fb84a6b1407418205af1904f9408fd2e85b196c98d1
X-Amz-Date: 20220707T094030Z
mc: <DEBUG> HTTP/1.1 400 Bad Request
Content-Length: 237
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/json
Date: Thu, 07 Jul 2022 09:40:19 GMT
Server: MinIO
Vary: Origin
X-Amz-Request-Id: 16FF82A1BB2425B5
X-Xss-Protection: 1; mode=block
{"Code":"XMinioMalformedIAMPolicy","Message":"conditions are not supported for action s3:GetBucketVersioning","Resource":"/minio/admin/v3/add-canned-policy","RequestId":"16FF82A1BB2425B5","HostId":"3473e3d7-6fef-4358-83e7-f7e333eb8675"}
mc: <DEBUG> Response Time: 3.844982ms
---------START-HTTP---------
PUT /minio/admin/v3/add-canned-policy?name=ReplicationRemoteUserPolicy.json HTTP/1.1
Host: xxxxx:xxxx
User-Agent: MinIO (linux; amd64) madmin-go/0.0.1 mc/RELEASE.2022-07-06T14-54-36Z
Content-Length: 1328
Accept-Encoding: gzip
Authorization: AWS4-HMAC-SHA256 Credential=admin/20220707//s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: 26a5f72146edcd356b967fb84a6b1407418205af1904f9408fd2e85b196c98d1
X-Amz-Date: 20220707T094030Z
HTTP/1.1 400 Bad Request
Content-Length: 237
Accept-Ranges: bytes
Content-Security-Policy: block-all-mixed-content
Content-Type: application/json
Date: Thu, 07 Jul 2022 09:40:19 GMT
Server: MinIO
Vary: Origin
X-Amz-Request-Id: 16FF82A1BB2425B5
X-Xss-Protection: 1; mode=block
{"Code":"XMinioMalformedIAMPolicy","Message":"conditions are not supported for action s3:GetBucketVersioning","Resource":"/minio/admin/v3/add-canned-policy","RequestId":"16FF82A1BB2425B5","HostId":"3473e3d7-6fef-4358-83e7-f7e333eb8675"}
---------END-HTTP---------
mc: <ERROR> Unable to add new policy: conditions are not supported for action s3:GetBucketVersioning
(1) admin-policy-add.go:140 cmd.mainAdminPolicyAdd(..) Tags: [cluster202, ReplicationRemoteUserPolicy.json, /dev/stdin]
(0) admin-policy-add.go:140 cmd.mainAdminPolicyAdd(..)
Commit:81c4a5ad6ee4 | Release-Tag:RELEASE.2022-07-06T14-54-36Z | Host:clone-instance-testv3 | OS:linux | Arch:amd64 | Lang:go1.18.3 | Mem:3.3 MB/17 MB | Heap:3.3 MB/7.7 MB.
How can I fix this?
I used helm chart install minio cluster, the tag of docker images is :RELEASE.2021-02-14T04-01-33Z

Paypal Adaptive

I am using paypal adaptive. Its working if i use sandbox account. But paypal is not working if i use live account.
Paypal throw error as below.
Array
(Server: Apache
X-EBAY-SOA-REQUEST-ID: 15674515-0c90-a115-45a6-9f3dfffd5017!AdaptivePayments!10.17.84.90![]
X-PAYPAL-SERVICE-VERSION: 1.0.0
X-PAYPAL-SERVICE-NAME: {http://svcs.paypal.com/types/ap}AdaptivePayments
X-PAYPAL-API-RC: 580029
X-EBAY-SOA-RESPONSE-DATA-FORMAT: NV
X-PAYPAL-OPERATION-NAME: Preapproval
CACHE-CONTROL: no-cache
X-PAYPAL-ERROR-RESPONSE: TRUE
X-EBAY-SOA-MESSAGE-PROTOCOL: NONE
Vary: Accept-Encoding
HTTP_X_PP_AZ_LOCATOR: dcg12.slc
Paypal-Debug-Id: 29d4c08e5ad57
Set-Cookie: X-PP-SILOVER] => name=LIVE6.APIT.1&silo_version=880&app=adaptivepaymentspartaweb_api3t&TIME=3709250391&HTTP_X_PP_AZ_LOCATOR=dcg12.slc;
Expires=Wed, 10 Aug 2016 12:28:21 GMT; domain=.paypal.com; path=/;
Secure; HttpOnly
Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Pragma: no-cache
Connection: close
Content-Type: text/plain;charset=UTF-8
In this error, its showing like missing some subscription parameter. But I could not find what parameter is missing. Since its working correctly in sandbox.
responseEnvelope.timestamp=2016-08-10T04:58:21.486-07:00
[responseEnvelope.ack] => Failure
[responseEnvelope.correlationId] => 29d4c08e5ad57
[responseEnvelope.build] => 24003818
[error(0).errorId] => 580029
[error(0).domain] => PLATFORM
[error(0).subdomain] => Application
[error(0).severity] => Error
[error(0).category] => Application
[error(0).message] => One of the required parameters for subscription is missing
[error(0).parameter(0)] => Subscription
)
Kindly check and give me the solution.

YII2 DOC-2.0: RESTFUL POST example return invalid json

When I use command in http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html:
curl -i -H "Accept:application/json" -H "Content-Type:application/json" -XPOST "my api path/users" -d '{"username": "testuser", "email": "user#123.com"}'
it returns:
HTTP/1.1 400 Bad Request
Date: Tue, 01 Mar 2016 06:51:03 GMT
Server: Apache/2.4.4 (Win32) PHP/5.6.9
X-Powered-By: PHP/5.6.9
Vary: Accept-Encoding
Content-Length: 148
Connection: close
Content-Type: application/json; charset=UTF-8
{"name":"Bad Request","message":"Invalid JSON data in request body: Syntax error
.","code":0,"status":400,"type":"yii\\web\\BadRequestHttpException"}curl: (6) Co
uld not resolve host: testuser,
curl: (6) Could not resolve host: email
curl: (3) [globbing] unmatched close brace/bracket at pos 13
Check your behavior method :
public function behaviors()
{
return [
[
'class' => 'yii\filters\ContentNegotiator',
'only' => ['index', 'view','create'],
'formats' => ['application/json' => Response::FORMAT_JSON,],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'index'=>['get'],
'view'=>['get'],
'create'=>['post'],
'update'=>['post'],
'delete' => ['delete'],
'deleteall'=>['post'],
],
],
];
}
I try the same with POSTMAN .If you are sending raw data then remove single quote before and after your data. like {"usename":"sdasda"...}

Linkedin Oauth invalid_signature

Getting following error when trying to send oauth request to linkedin. Tried changing all configuration settings on Linkedin Developer page, without luck.
Zend_Http_Response Object
(
[version:protected] => 1.1
[code:protected] => 401
[message:protected] => Unauthorized
[headers:protected] => Array
(
[Server] => Apache-Coyote/1.1
[Www-authenticate] => OAuth realm="https%3A%2F%2Fapi.linkedin.com", oauth_problem="signature_invalid", oauth_problem_advice="com.linkedin.security.auth.pub.LoginDeniedInvalidAuthTokenException%20while%20obtaining%20request%20token%20for%20%3APOST%26https%253A%252F%252Fapi.linkedin.com%252Fuas%252Foauth%252FrequestToken%26oauth_callback%253Dhttp%25253A%25252F%25252Fsocialnucleus.org%25252Fwall%25252Flinkedin%25252Findex%25252Fformat%25252Fsmoothbox%25252Ftask%25252Fstream%2526oauth_consumer_key%253D753ndm4jkq5ug9%2526oauth_nonce%253D296db6c938b6b3a7af93bd01c37e4d5f%2526oauth_signature_method%253DHMAC-SHA1%2526oauth_timestamp%253D1409219193%2526oauth_version%253D1.0%2526scope%253Drw_nus%0AOAU%3A753ndm4jkq5ug9%7C%2A01%7C%2A01%7C%2A01%3A1409219193%3AKNkpSGf5VSdXkeLYVO0xW%2Fr6N%2BE%3D"
[Content-type] => application/x-www-form-urlencoded;charset=UTF-8
[Content-encoding] => gzip
[Vary] => Accept-Encoding
[Date] => Thu, 28 Aug 2014 09:47:13 GMT
[X-fs-uuid] => 2ad6973e6d8d8e13004a6ed9fc2a0000
[X-li-uuid] => KtaXPm2NjhMASm7Z/CoAAA==
[X-li-fabric] => PROD-ELA4
[Transfer-encoding] => chunked
[Connection] => keep-alive
[X-li-pop] => PROD-ELA4
[Set-cookie] => lidc="b=LB37:g=108:u=1:i=1409219233:t=1409305633:s=132873074"; Expires=Fri, 29 Aug 2014 09:47:13 GMT; domain=.linkedin.com; Path=/
)
[body:protected] => 1aa...
)
Start with the guide to debug API calls: https://developer.linkedin.com/documents/debugging-api-calls
It seems that the signature isn't being generated correctly. Use OAuth Test Console: https://developer.linkedin.com/oauth-test-console to generate the signature and the request URL.

Twitter api response unreadable

We have been using twitter api for a while now but suddenly it stopped working. Tracing it back it seems that the response from the MSXML2.ServerXMLHTTP request is unreadable by ASP vbscript.
Even a simple GET request to a page turns into invalid charactors. Opening https://api.twitter.com/oauth/request_token in a browser will show a string "Failed to validate oauth signature and token". When I try to get the same thing in ASP it returns unreadable data.
<% #LANGUAGE="VBSCRIPT" %>
<%
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.open "GET", "https://api.twitter.com/oauth/request_token", false
objXMLHTTP.send ""
Response.Write "<pre>"
Response.Write objXMLHTTP.responseText
Response.Write "<hr>"
Response.Write objXMLHTTP.getAllResponseHeaders()
Response.Write "</pre>"
%>
output is:
?
------
Date: Thu, 06 Dec 2012 09:12:17 GMT
Status: 401 Unauthorized
X-MID: caa889032d29f5316a855dcadd748211ed4ee276
X-Frame-Options: SAMEORIGIN
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Content-Type: text/html; charset=utf-8
Last-Modified: Thu, 06 Dec 2012 09:12:16 GMT
Pragma: no-cache
X-Transaction: dd71c8da0813a966
Expires: Tue, 31 Mar 1981 05:00:00 GMT
X-Runtime: 0.02056
Set-Cookie: k=10.36.75.125.1354785136971277; path=/; expires=Thu, 13-Dec-12 09:12:16 GMT; domain=.twitter.com
Set-Cookie: guest_id=v1%3A135478513698331395; domain=.twitter.com; path=/; expires=Sat, 06-Dec-2014 21:12:16 GMT
Set-Cookie: _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCFihfG87ASIKZmxhc2hJQzonQWN0aW9uQ29u%250AdHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7ADoHaWQiJTMx%250AMzI0YjhkNDc4YmQ4MDExMjlhNTI2NWU5OTAxNDVi--97206a42b05d8cb85fbd88ccd9ccb8aaca39ebef; domain=.twitter.com; path=/; HttpOnly
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 62
Server: tfe
the ? is infact a string with more charactors but cannot be handled because it contains a CHR(0).
Now I figured it might be because of the Content-Encoding: gzip, but even when sending an objXMLHTTP.setRequestHeader "Accept-Encoding", "none" (or any other format) it returns the same.
Anybody has any idea what I can do to solve this?
I have been looking at this for hours now and just after asking I find the awnser! Twitter API requires a user-agent to be sent a long with the request. So it was as simple as:
Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
objXMLHTTP.open "GET", "https://api.twitter.com/oauth/request_token", false
objXMLHTTP.SetRequestHeader "User-Agent", "something"
objXMLHTTP.send()