3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

認証済みのiOSアプリから、Safariへ認証用Token/Cookieを渡す方法

Last updated at Posted at 2016-12-05

結論

Safariで開くURLに、One Time Passwordのような仕組みを利用した、一時的なTokenを埋め込む。

  • 開くURLは基本httpsに限定すべき
  • URLが漏れたとしても、有効期限が過ぎたら無効になる

調査した内容

  • WebViewには、HeaderやCookieにTokenを渡せるが、Safariには出来ない
  • 一時htmlファイルを書いて、その中にjavascriptでTokenをターゲットURLにPostする案もある。但し、この場合、該当一時htmlは公開領域に置く必要あり、脆弱性になり兼ねない
参考:

http://stackoverflow.com/questions/7997010/open-request-in-safari-with-custom-http-headers
http://stackoverflow.com/questions/13196192/open-url-hosted-using-post-method-in-safari-using-sharedapplication-openurl-meth
http://stackoverflow.com/questions/9880922/ios-is-it-possible-to-open-nsurlrequest-directly-in-safari/9881108#9881108

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?