将 OAuth 2 与桌面 c# 应用程序一起使用 [英] Using OAuth 2 with desktop c# Application
本文介绍了将 OAuth 2 与桌面 c# 应用程序一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我以前从未使用过 oauth,所以我希望我的应用程序在系统的默认浏览器上打开一个 url,然后用户登录、授权等,然后我需要将授权码发送回我的应用程序,是否有怎么做?我正在使用 Trakt 的 API.
I never used oauth before, so i wanted my app to open a url on system's default browser, then the user logs in, authorize, etc etc and then i need to send back the authorization code to my application, is there a way to do it? i'm using Trakt's API.
推荐答案
有多种选择,以下是其中一些:
There are multiple options, here are some of them:
- 为回调 URL 使用自定义 URL 方案,例如"myapp://callback/after/oauth";
- 在浏览器标题中提供授权码,并从您的应用程序中观察浏览器窗口标题;
- 从您的应用程序中临时启动网络服务器并使用回调 URLhttp://localhost:port/".
Google 为桌面应用推荐 #2 和 #3.#1 通常用于移动设备:https://developers.google.com/accounts/docs/OAuth2InstalledApp
Google recommends #2 and #3 for desktop applications. #1 is normally used for mobile: https://developers.google.com/accounts/docs/OAuth2InstalledApp
这篇关于将 OAuth 2 与桌面 c# 应用程序一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文