什么是重定向URI?它是如何应用到iOS应用对OAuth2.0的? [英] What's a redirect URI? how does it apply to iOS app for OAuth2.0?

查看:1488
本文介绍了什么是重定向URI?它是如何应用到iOS应用对OAuth2.0的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里初学编程的,PLZ原谅无知和放大器;解释将是非常好的:)

beginner programmer here, plz pardon ignorance & explanations will be really nice :)

我试着阅读教程一定的OAuth 2.0服务,但我不明白这个重定向URI ......在我的特定情况下,比方说,我正在试图建立一个使用OAuth 2.0的iPhone应用程序对于一些服务。我有已生成的应用程序ID,但我需要提供诸如此类的一些重定向URI来生成API密钥。

i've tried to read the tutorials for a certain OAuth 2.0 service, but i don't understand this redirect URI... in my particular context, let's say i'm trying to build an iPhone app that uses OAuth 2.0 for some service. i have an App ID that was generated, but i need to provide some sort of redirect URI to generate the API key.

这是我应该在什么地方举办自己的URL?顾名思义,我认为重定向URI应该是重定向有人的地方。我唯一​​的猜测是,它是一个用户被重定向到他们登录到售后服务的URL。

is this a URL that i'm supposed to host somewhere myself?? as the name suggests, i would think that the redirect URI is supposed to "redirect" someone somewhere. my only guess is that it's the URL a user is redirected to after they log in to the service.

然而,即使这种假设是正确的,我不明白一件事 - 怎么我的应用程序被再次打开我已将其发送给浏览器为用户登录后

However, even if that assumption is correct, i don't understand one other thing - how can my app be opened again after i've sent them to the browser for the user login?

推荐答案

阅读:

<一个href=\"http://www.quora.com/OAuth-2-0/How-does-OAuth-2-0-work\">http://www.quora.com/OAuth-2-0/How-does-OAuth-2-0-work

或者更简单的,但快速的解释:

or an even simpler but quick explanation:

<一个href=\"http://agileanswer.blogspot.se/2012/08/oauth-20-for-my-ninth-grader.html\">http://agileanswer.blogspot.se/2012/08/oauth-20-for-my-ninth-grader.html

重定向URI是应用程序的回调入口点。想想的OAuth对于Facebook是如何工作的 - 之后最终用户接受的权限,东西已被Facebook被要求返回到应用程序,而东西是重定向的URI。此外,重定向URI应该比应用程序的初始入口点不同。

The redirect URI is the callback entry point of the app. Think about how OAuth for Facebook works - after end user accepts permissions, "something" has to be called by Facebook to get back to the app, and that "something" is the redirect URI. Furthermore, the redirect URI should be different than the initial entry point of the app.

另外一个关键点这个难题是,您可以从给一个网页视图的URL启动应用程序。要做到这一点,我只是跟着就在这里指南:

The other key point to this puzzle is that you could launch your app from a URL given to a webview. To do this, i simply followed the guide on here:

<一个href=\"http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html\">http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

<一个href=\"http://inchoo.net/mobile-development/iphone-development/launching-application-via-url-scheme/\">http://inchoo.net/mobile-development/iphone-development/launching-application-via-url-scheme/

注:这些最后的2个链接,HTTP://工作在开放移动Safari浏览器,但电话://不模拟器工作

在第一个应用程序,我称之为

in the first app, I call

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"secondApp://"]];

在我的第二个应用程序,我注册secondApp(而不是secondApp://)作为URL方案的名称,与我公司作为URL标识

In my second app, I register "secondApp" (and NOT "secondApp://") as the name of URL Scheme, with my company as the URL identifier.

这篇关于什么是重定向URI?它是如何应用到iOS应用对OAuth2.0的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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