Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosted Authentication postOAuthToken issn't working. #42

Closed
jeffreymoelands opened this issue Nov 22, 2021 · 7 comments
Closed

Hosted Authentication postOAuthToken issn't working. #42

jeffreymoelands opened this issue Nov 22, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@jeffreymoelands
Copy link

Error: An error was encountered during the on_headers event

@lanlin
Copy link
Owner

lanlin commented Nov 23, 2021

@jeffreymoelands any more detail info please? which version? what's the error shows?

@jeffreymoelands
Copy link
Author

jeffreymoelands commented Nov 23, 2021

@lanlin excuse me, version 4.2.5

Error log:

*   Trying 2606: 4700: : 6812: 284:443...
* Connected to api.nylas.com (2606: 4700: : 6812: 284) port 443 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /usr/local/etc/[email protected]/cert.pem
*  CApath: none
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=nylas.com
*  start date: Jun  3 00: 00: 00 2021 GMT
*  expire date: Jun  2 23: 59: 59 2022 GMT
*  subjectAltName: host "api.nylas.com" matched cert's "*.nylas.com"
*  issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
*  SSL certificate verify ok.
> POST /oauth/token?grant_type=authorization_code&client_id=xxx&client_secret=yyy&code=81AkTUxgxegljRQ0bHJvN7lFGuZzVW%23 HTTP/1.1
Host: api.nylas.com
Content-Length: 0
User-Agent: GuzzleHttp/7

* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 BAD REQUEST
< Date: Tue,
23 Nov 2021 07: 40: 04 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< X-XSS-Protection: 1
< X-Content-Type-Options: nosniff
< Content-Security-Policy: default-src https: 'unsafe-eval' 'unsafe-inline'; object-src 'none'
< CF-Cache-Status: DYNAMIC
< Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< Server: cloudflare
< CF-RAY: 6b28bf4dbb14fa20-AMS
* Failed writing header
* Closing connection 0
{
    "@context": "/contexts/Error",
    "@type": "hydra:Error",
    "hydra:title": "An error occurred",
    "hydra:description": "An error was encountered during the on_headers event",
    "trace": [

@lanlin lanlin added the bug Something isn't working label Nov 23, 2021
@lanlin
Copy link
Owner

lanlin commented Nov 23, 2021

@jeffreymoelands
Copy link
Author

Hi @lanlin thx for fast responding, unfortunately it doesn't work. I think you do need to send query parameters. They also do this in their postman collection.

@lanlin
Copy link
Owner

lanlin commented Nov 24, 2021

image

@jeffreymoelands strange~, I've tested and it works.

here's the document: https://developer.nylas.com/docs/api/#post/oauth/token

I just use the same way as the nylas's example, maybe there's no need to use query parameters anymore.

  1. try update your API version from nylas dashboard.

  2. check the parameters passed to getOAuthAuthorizeUrl: https://developer.nylas.com/docs/api/#get/oauth/authorize
    like response_type for server side can only be code...

@jeffreymoelands
Copy link
Author

@lanlin maybe I found the problem. Does your code ends with a #? My code ends with a # and in the url it parsed by guzzle to %23 and from then nylas don't recognizes this code.

@lanlin
Copy link
Owner

lanlin commented Nov 29, 2021

@jeffreymoelands well, I think the # is not a valid character for switch code, you may need to remove it, or you should ask for help from nylas.

@lanlin lanlin closed this as completed Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants