How to authenticate instagram without redirect url? no server

做~自己de王妃 提交于 2019-12-10 13:19:39

问题


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


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/13160375/how-to-authenticate-instagram-without-redirect-url-no-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!