Cov txheej txheem:

Google nkag mus rau tokens ntev npaum li cas?
Google nkag mus rau tokens ntev npaum li cas?

Video: Google nkag mus rau tokens ntev npaum li cas?

Video: Google nkag mus rau tokens ntev npaum li cas?
Video: Npaum Li Cas - David Yang (Prod. By Keeneng Vang) 2024, Plaub Hlis Ntuj
Anonim

www.googleapis.com/auth/cloud-platform. lifetime: Lub sijhawm ntawm lub nkag mus token hauv vib nas this, tom qab uas cov token tas sij hawm. Qhov siab tshaj plaws token lub neej yog 1 teev (3,600 vib nas this).

Nyob rau hauv no hais txog, yuav tsum tau ntev npaum li cas ib tug access token?

Luv luv cov cim feem ntau muaj lub neej ntawm ib teev lossis ob, thaum ntev - nyob cov cim feem ntau muaj lub neej ntev li ntawm 60 hnub.

Tsis tas li ntawd, kuv yuav ua li cas thiaj tau txais Google nkag token? Cov kauj ruam yooj yim

  1. Tau txais OAuth 2.0 daim ntawv pov thawj los ntawm Google API Console.
  2. Tau txais ib qho token nkag los ntawm Google Tso Cai Server.
  3. Tshawb xyuas cov kev nkag mus tau tso cai los ntawm tus neeg siv.
  4. Xa cov token nkag mus rau API.
  5. Refresh tus token nkag, yog tias tsim nyog.

Khaws qhov no rau hauv kev txiav txim siab, puas nkag tokens tas sijhawm?

Los ntawm lub neej ntawd, nkag mus tokens siv tau rau 60 hnub thiab programmatic refresh cov cim yog siv tau rau ib xyoos. Tus tswv cuab yuav tsum tso cai rau koj daim ntawv thov rov qab thaum rov kho dua tokens tas sij hawm.

Kuv yuav ua li cas thiaj li siv tau cov tokens tas sij hawm?

Qhov no tuaj yeem ua tiav siv cov kauj ruam hauv qab no:

  1. hloov expires_in mus rau lub sij hawm tas sij hawm (epoch, RFC-3339 / ISO-8601 datetime, thiab lwm yam)
  2. khaws lub sij hawm tas sij hawm.
  3. ntawm txhua qhov kev thov, tshawb xyuas lub sijhawm tam sim no tiv thaiv lub sijhawm tas sijhawm thiab ua kom lub token refresh thov ua ntej qhov kev thov kev pab yog tias access_token tau tas sijhawm.

Pom zoo: