一大坨GoogleAPI的学习笔记之二(oAuth2.0总结)
来源:互联网 发布:清理mac系统垃圾软件 编辑:程序博客网 时间:2024/05/17 01:51
本文地址:http://blog.csdn.net/btyh17mxy/article/details/9633279,转载需注明。
本文只针对本地应用,其他应用类型可能有不同。
URL 格式
需要注意的是该地址是https而不是http,非加密请求是被拒绝的。
https://accounts.google.com/o/oauth2/auth
获取access token的第一个请求。其负责处理活跃session,验证用户。该请求的结果包括access tokens, refresh tokens, and authorization codes.参数:
response_type
code
相应类型,本地应用使用的值应为"code"client_id
the client_id
obtained from theAPIs ConsoleIndicates the client that is making the request. The value passed in this parameter must exactly match the value shown in the APIs Console.redirect_uri
one of theredirect_uri
values registered at the APIs Console接受响应的地址,该地址必须跟APIs Console 中注册的地址完全一样(including the http or https schemes, case, and trailing '/').可以是urn:ietf:wg:oauth:2.0:oob
或 http://localhost
port. See choosing a redirect_uri for more details.scope
该参数表明了应用请求的权限种类这些权限会在授权页展示给用户。(之后会详细说明这个参数)state
any stringIndicates any state which may be useful to your application upon receipt of the response. The Google Authorization Server roundtrips this parameter, so your application receives the same value it sent.login_hint
email address
orsub
identifierWhen your application knows which user it is trying to authenticate, it may provide this parameter as a hint to the Authentication Server. Passing this hint will either pre-fill the email box on the sign-in form or select the proper multi-login session, thereby simplifying the login flow.一个授权链接实例:'''https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fmail.google.com+https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds&redirect_uri=http://localhost:8888&response_type=code&client_id=53354213461.apps.googleusercontent.com'''
授权页面:
总之,如果要请求授权的话就让用户在浏览器打开这个这个链接(传入相应参数),然后获取到该请求的返回值就行了。
Google Drive scopes
Scopes available for the Drive API are:
https://www.googleapis.com/auth/drive.file
Per-file access to files created or opened by the apphttps://www.googleapis.com/auth/drive
Full, permissive scope to access all of a user's files. Request this scope only when it is strictly necessary. Tokens with scope https://docs.google.com/feeds
are accepted and treated the same as tokens with scopehttps://www.googleapis.com/auth/drive
.https://www.googleapis.com/auth/drive.apps.readonly
Allows apps read-only access to the list of Drive apps a user has installed.https://www.googleapis.com/auth/drive.readonly
Allows read-only access to file metadata and file contenthttps://www.googleapis.com/auth/drive.readonly.metadata
Allows read-only access to file metadata, but does not allow any access to read or download file contenthttps://www.googleapis.com/auth/drive.install
Special scope used to let users approve installation of an apphttps://www.googleapis.com/auth/drive.appdata
Allows access to the Application Data folderhttps://www.googleapis.com/auth/drive.scripts
Allows access to Apps Script filesGoogle Calendar scopes
https://www.googleapis.com/auth/calendar
read/write access to Calendarshttps://www.googleapis.com/auth/calendar.readonly
read-only access to CalendarsTo request access using OAuth 2.0, your application needs the scope information, as well as information that Google supplies during application registration (such as the client ID and/or the client secret).
Gmail scopes
The scope for IMAP and SMTP access is https://mail.google.com/
.
Google Contacts scopes
- 一大坨GoogleAPI的学习笔记之二(oAuth2.0总结)
- 一大坨GoogleAPI的学习笔记之一(oAuth2.0)
- 一大坨GoogleAPI的学习笔记之三(基于oAuth2.0的domain-wide authentication)
- OAuth2.0 学习笔记
- OAuth2.0学习笔记
- OAuth2.0 学习(二) Server 设计
- 学习 OAuth2.0 笔记( 一 )
- 【学无止境】基于ThinkPHP的OAuth2.0实现 ------ OAuth2.0个人学习笔记 One
- 【学无止境】 基于ThinkPHP的OAuth2.0实现 ----OAuth2.0 个人学习笔记 Two
- Spring cloud oauth2.0学习总结
- 【OAuth2.0学习笔记一】原理介绍
- [OAuth]OAuth2学习笔记
- OAuth2学习笔记
- vue学习笔记之二(总结一下)
- Angularjs 学习笔记总结之二
- OAuth2.0指南(二)
- 新浪OAuth2学习分享总结
- OAuth2.0的学习和实践
- vim 官方网站代替
- “发明在商业上获得成功”对专利法22条第三款有关创造性规定的影响
- hdu 2795 Billboard
- Vector实现线程安全
- poj-1250Tanning Salon
- 一大坨GoogleAPI的学习笔记之二(oAuth2.0总结)
- iptables学习 01
- hdu - 4627 - The Unsolvable Problem
- Cocos2D-iphone CCLayer中的两种触摸(touch)处理方式
- Sftp和ftp 区别、工作原理等(汇总ing)
- hdu-统计元音
- CodeForces-MemSQL start[c]up Round 1-A. Square and Rectangles
- Starling在应用于移动设备开发时的注意事项
- 半透明Panel控件问题