How to Get Foursquare Access Token?

To get Foursquare Access Token, Firstly you need to Register an App using Foursquare Developer Tool as showing in below:

  1. Go to https://developer.foursquare.com/ and log in
  2. Click on My Apps in top menu.
  3. Click Create New App button.
  4. Name your Application and fill the required field with URL of your website.

How To Get Client ID and Client Secret?


  1. Go to Streams App Auth Setting page https://foursquare.com/developers/apps.
  2. Here display Client Id and Client Secret Key.

 

How To Get Foursquare Access Token?


  1. Direct users to Foursquare with your registered redirect URL.
    https://foursquare.com/oauth2/authenticate
    ?client_id=YOUR_CLIENT_ID
    &response_type=code
    &redirect_uri=YOUR_REGISTERED_REDIRECT_URI

  2. If you visit the above link in Step 1, they will be redirected back to your URI with a code.
  3. Your server should exchange the code it got in step 2 for an access token.
    https://foursquare.com/oauth2/access_token
    ?client_id=YOUR_CLIENT_ID
    &client_secret=YOUR_CLIENT_SECRET
    &grant_type=authorization_code
    &redirect_uri=YOUR_REGISTERED_REDIRECT_URI
    &code=CODE

  4. Above Step 3 result response will be JSON.