oauth

oauth简单使用

爱⌒轻易说出口 提交于 2020-01-13 20:10:15
一、oauth原理参考    理解OAuth 2.0 二、本例中采用授权码模式      大致流程   (A)用户访问客户端,后者将前者导向认证服务器。   (B)用户选择是否给予客户端授权。   (C)假设用户给予授权,认证服务器将用户导向客户端事先指定的"重定向URI"(redirection URI),同时附上一个授权码。   (D)客户端收到授权码,附上早先的"重定向URI",向认证服务器申请令牌。这一步是在客户端的后台的服务器上完成的,对用户不可见。   (E)认证服务器核对了授权码和重定向URI,确认无误后,向客户端发送访问令牌(access token)和更新令牌(refresh token)。   参数含义   response_type:表示授权类型,必选项,此处的值固定为"code"   client_id:表示客户端的ID,必选项   redirect_uri:表示重定向URI,可选项   scope:表示申请的权限范围,可选项,本例中无   state:表示客户端的当前状态,可以指定任意值,认证服务器会原封不动地返回这个值,本例中无 三、项目中依赖oauth相关jar <!-- oauth --> <dependency> <groupId>org.apache.oltu.oauth2</groupId> <artifactId>org.apache

Vue.js——使用$.ajax和vue-resource实现OAuth的注册、登录、注销和API调用

∥☆過路亽.° 提交于 2020-01-13 19:39:12
概述 上一篇我们介绍了如何使用vue resource处理HTTP请求,结合服务端的REST API,就能够很容易地构建一个增删查改应用。 这个应用始终遗留了一个问题,Web App在访问REST API时,没有经过任何认证,这使得服务端的REST API是不安全的,只要有人知道api地址,就可以调用API对服务端的资源进行修改和删除。 今天我们就来探讨一下如何结合Web API来限制资源的访问。 本文的主要内容如下: 介绍传统的Web应用和基于REST服务的Web应用 介绍OAuth认证流程和密码模式 创建一个基于ASP.NET Identity的Web API应用程序 基于$.ajax实现OAuth的注册、登录、注销和API调用 基于vue-resource实现OAuth的注册、登录、注销和API调用 本文的最终示例是结合上一篇的CURD,本文的登录、注册、注销和API调用功能实现的。 本文9个示例的源码已放到GitHub,如果您觉得本篇内容不错,请点个赞,或在GitHub上加个星星! Page Demo GitHub Source 基于$.ajax的示例如下: 注册示例 登录和注销示例 登录获取token并调用API示例 注册、登录、注销、调用API综合示例 基于vue-resource的示例如下: 注册示例 登录和注销示例 登录获取token并调用API示例 注册、登录

Storing OAuth keys in code for iPhone apps

和自甴很熟 提交于 2020-01-13 13:11:22
问题 I'm writing an iPhone app that integrates with third party APIs. These APIs use OAuth (key/secret specific to my app not per user) in order to authenticate which app the request is being made in behalf of. Is it secure (or how secure) is it to simply put the key/secret in code? Can this sort of data be reverse-engineered? Is there a better way to go about including this data in a project? 回答1: There is no place on the iPhone to hide data. A user with a jailbroken iPhone has more control over

FacebookTokenError: This authorization code has been used

北城以北 提交于 2020-01-13 06:52:10
问题 Ok, so this is a common error with many causes. I am trying to modify an existing Node-Passport-Facebook module to have local images from the desktop uploaded to a users Facebook account after they log in. That is my goal. This is the code module I am extending https://github.com/passport/express-4.x-local-example which in turn is based on https://github.com/jaredhanson/passport-facebook I never get past console.log('ERROR HERE.. . with an error of "This authorization code has been used."

Generating Signatures for the Authentication Header in PHP - Paypal

笑着哭i 提交于 2020-01-13 06:41:05
问题 Having recently finished the process of having created the script that retrieves permissions from a account holder I now find that I have to convert the retrieved access token and token secret (from the GetAccessToken response) to the API signature in order to create a X-PAYPAL-AUTHORIZATION header. The X-PAYPAL-AUTHORIZATION header contains: A timestamp The access token from the GetAccessToken response A signature generated from the following information: Your API username Your API password

Get access_token using Windows Service's or Console App. for Instagram Api

时光怂恿深爱的人放手 提交于 2020-01-13 05:50:11
问题 My windows service is collect instagram datas from instagram api. I was using client_id but this uses format is removed. Instagram api is want to access_token but Oauth 2.0 is web-based. or not? I using .NET and my application type is windows service and web request don't work because this call url: "https://www.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code" is have one more contain redirect. so web response haven't contain my web application

Reauthenticate user from Google/Facebook accounts

岁酱吖の 提交于 2020-01-13 05:22:08
问题 So I need to create a REST API to provide functionality to an IOS app. We allow users to sign up with just a plain account OR with Facebook/Google login . I have been reading up on OAuth lately and I think I understand the process of how I would use OAuth in my situation (when users using Facebook/Google login ) to register an account on my app: I register my IOS app with various social providers (eg. FB/Google). I end up with client ID/client secret keys that I safely store in the backend.

Best practice with tincan LRS/LMS launching and OAuth

拈花ヽ惹草 提交于 2020-01-13 03:41:13
问题 I'm working on building a tin-can based LMS. We launch activites from the LMS according to this guide, with the appropriate query parameters for the activity to communicate back to the LRS xapi endpoint. https://github.com/RusticiSoftware/launch/blob/master/lms_lrs.md The thing we're struggling with is authentication of incoming statements. For now we're cheating and just using session cookies as the activities are on the same domain as the LMS, however we want to move to external activities.

Github create token with 2 factor authentication

我与影子孤独终老i 提交于 2020-01-12 09:58:08
问题 I am trying to get a authorize a user and get a token back. The user has 2 factor authentication on. This is the code I am tring to use. It will not accept the code I get via SMS. This works if the user does not have 2fa enabled. curl -i -u $user -H "X-GitHub-OTP: $code" \ -d '{"scopes": [ "repo" ], "note": "program"}' \ https://api.github.com/authorizations http://developer.github.com/v3/auth/#working-with-two-factor-authentication http://developer.github.com/v3/oauth/#create-a-new

OAuth on REST API for mobile app

你离开我真会死。 提交于 2020-01-12 08:27:29
问题 Ι'm working on the backend of a mobile app, building a RESTful API using ASP.NET MVC 4 Web Api. The app will run on iOS and Android. My users will be allowed to login only with their facebook account, and only when logged in, they will be able to use the whole functionality. I don't have much experience with mobile apps and that's more of a design question: Which of the two scenarios (or maybe a third one?) seems better design to you about who should be responsible for the facebook