Hi Andy,
I tried generating the bearer token using this code but it says the token is expired or invalid.
Which part do you think may have a problem?
Trying 104.244.42.194…
Connected to api.twitter.com (104.244.42.194) port 443 (#0)
ALPN, offering http/1.1
Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
successfully set certificate verify locations:
CAfile: /home/danzhu/python/anaconda3/ssl/cacert.pem
CApath: none
TLSv1.2 (OUT), TLS header, Certificate Status (22):
TLSv1.2 (OUT), TLS handshake, Client hello (1):
TLSv1.2 (IN), TLS handshake, Server hello (2):
TLSv1.2 (IN), TLS handshake, Certificate (11):
TLSv1.2 (IN), TLS handshake, Server key exchange (12):
TLSv1.2 (IN), TLS handshake, Server finished (14):
TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
TLSv1.2 (OUT), TLS change cipher, Client hello (1):
TLSv1.2 (OUT), TLS handshake, Finished (20):
TLSv1.2 (IN), TLS change cipher, Client hello (1):
TLSv1.2 (IN), TLS handshake, Finished (20):
SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
ALPN, server accepted to use http/1.1
Server certificate:
subject: C=US; ST=California; L=San Francisco; O=Twitter, Inc.; OU=Twitter Security; CN=api.twitter.com
start date: Jun 29 00:00:00 2016 GMT
expire date: Sep 19 12:00:00 2019 GMT
subjectAltName: host “api.twitter.com” matched cert’s “api.twitter.com”
issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
SSL certificate verify ok.
POST /oauth2/token HTTP/1.1
Host: api.twitter.com
User-Agent: curl/7.49.0
Accept: /
Authorization: Basic dFBucGtQdXk4cDFROEt6c1c0RXlhSVRJaDpjdTNoUVNPekRpNVMzaW4xNFRKaEl0djhqbGZ4bU9uUllzTkdNWFJ0TTRhUDlYQk81cg==
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 29
upload completely sent off: 29 out of 29 bytes
< HTTP/1.1 200 OK
< cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
< content-disposition: attachment; filename=json.json
< content-length: 153
< content-type: application/json;charset=utf-8
< date: Fri, 08 Jun 2018 05:11:17 GMT
< expires: Tue, 31 Mar 1981 05:00:00 GMT
< last-modified: Fri, 08 Jun 2018 05:11:17 GMT
< ml: S
< pragma: no-cache
< server: tsa_a
< set-cookie: personalization_id=“v1_LHNnRKme/hf+mO2RSK15sA==”; Expires=Sun, 07 Jun 2020 05:11:17 GMT; Path=/; Domain=.twitter.com
< set-cookie: guest_id=v1%3A152843467746996227; Expires=Sun, 07 Jun 2020 05:11:17 GMT; Path=/; Domain=.twitter.com
< status: 200 OK
< strict-transport-security: max-age=631138519
< x-connection-hash: 4ca2a057c6063d842b34d66bf16c26c3
< x-content-type-options: nosniff
< x-frame-options: DENY
< x-response-time: 13
< x-transaction: 00e9365900d67084
< x-tsa-request-body-time: 0
< x-twitter-response-tags: BouncerCompliant
< x-ua-compatible: IE=edge,chrome=1
< x-xss-protection: 1; mode=block; report=https://twitter.com/i/xss_report
<
Connection #0 to host api.twitter.com left intact
{“token_type”:“bearer”,“access_token”:“AAAAA…”}
Thank you.