instagram api 中的回调 url 是什么以及如何实现它 [英] What is callback url in instagram api and how to can I implement it

查看:46
本文介绍了instagram api 中的回调 url 是什么以及如何实现它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学者程序员

我正在尝试使用 instagram 的实时照片更新 api

I'm trying to use instagram's realtime Photo Updates api

我的目的是使用这个API CONSOLE的订阅方式
https://apigee.com/console/instagram

My purpose is use this API CONSOLE's subscription method
https://apigee.com/console/instagram

但我无法理解和处理回调网址

But I can't understand and handle callback url

回调url的作用是什么?

What is the callback url's function?

我该如何实现回调网址?

And How can I implement the callback url?

推荐答案

回调 url"(也称为 redirect_url),是 Instagram 在之后将用户发送到的 URL/strong> 他们已登录 Instagram,并授权您的应用程序读取他们的数据.

The "callback url" (also referred to as redirect_url), is the URL Instagram will send users to after they have logged into Instagram, and authorized your application to read their data.

这是 OAuth 2 规范 的一部分,Instagram(和许多其他人)使用它来控制对他们的 API.

This is part of the OAuth 2 Spec, which Instagram (and many others) use to control access to their API.

OAuth 2流程"的简短版本是这样的:

The short version of the OAuth 2 "flow" is this:

  • 您使用您的应用程序 ID 和重定向 URL 将用户发送到 Instagram 页面.
  • 用户在其页面上登录 Instagram 并授权您的应用程序.
  • 然后 Instagram 会将用户发送回您的应用程序(使用重定向 URL 值),以及您可以用来访问他们数据的令牌.

GitHub 有一个关于 OAuth 如何在他们的服务器上工作的优秀指南,你会发现与 Instagram 非常相似.

GitHub has an excellent guide to how OAuth works on their server, which you will find very similar to Instagram's.

因此回调网址"应设置为您的应用程序服务器的网址.例如,http://myapp.com/auth.或者,如果您在本地工作,则可以使用 http://localhost:3000/auth.

So the "callback url" should be set to the URL of your application server. For example, http://myapp.com/auth. Or, if you are working locally, you would use http://localhost:3000/auth.

注意:对于 Instagram(以及大多数其他 API),回调 URL 在您注册客户端时会永久设置.因此,您通常必须为实时服务器和本地服务器创建单独的客户端.

Note: With Instagram (as well as most other APIs), the callback URL is permanently set when you register your client. So you'll often have to create separate clients for your live server, and your local one.

这篇关于instagram api 中的回调 url 是什么以及如何实现它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆