简体   繁体   中英

How to authenticate instagram without redirect url? no server

I am trying to write a client side authentication for instagram, however I want to do so without a redirect uri, i will not be hosting a sever.

https://instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token

the dev api states this is the implicit way, however i cannot find a solution

The short answer is, you cannot do without a redirect uri.

This is how OAuth works. You need at least a uri to receive the access token. The uri could be hosted on localhost using a simple web server though.

Follow the Client-Side (Implicit) Authentication flow. Use the credentials from the app you registered at the Instagram developer portal. So change CLIENT-ID and REDIRECT-URI from that url to the credentials of your registered app.

From your app, send the user to that link. If they accept they will be redirected to the redirect uri (which should be somewhere in your app). On the page they get redirected, the page will have a hash containing an acces token.

Get that from the url and use it to request data from the instagram api. You will need jsonp for the requests. See an example in action in a similar thread

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