简体   繁体   中英

Using Foursquare API on an Android app

I want to get user's data (check in, friend, etc) after they have logged in in my app.

I used this code which is more or less the same of my app.

I don't understand some things:

  1. What is the callback url? Can I choose any website?
  2. I can get the access token, now how can I get user's data?
  3. What is the best choice to save this data?

The sample code you have referenced is for connecting to foursquare using the token flow . It is used for apps that do not have their own servers, and hence you do not need to have a website that you control. Your registered redirect URI can be a fake URL, which the user will be redirected to in the webview, at which point you can extract the access token from the URL.

If you do have a website you control, the preferred method of connecting is the access code flow. In this case, the callback url must be a website that you control. This flow has the advantage that your client secret does not need to be distributed with your app, and so attackers cannot extract your secret from the app and use it to authenticate users.

Once you have the token, you'll be able to use the api endpoints , along with the access token, to make requests on behalf of the user.

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