简体   繁体   中英

Authentication through Oauth2

For getting results using Google Analytics, if I access the following URL:

https://www.googleapis.com/analytics/v3/data/ga?ids=gaxxxxx&start-date=2014-07-01&end-date=2014-07-15&metrics=gapageviews&dimensions=gapagePath&access_token= {YOUR_ACCESS_TOKEN}

I get JSON response if and only if I get an access token using oauth2 playground and navigate to the URL mentioned above, but that access token is only valid for 1 hour, kindly tell how can I automatically authenticate using auth2 so need of access token is not there. Thanx

Store the token in the shared preferences in Android (or in persistent storage, in case of C#).

If you get authenticated using that token, it's fine; otherwise, request again and save the token again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM