微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Hello.js JavaScript 的 OAuth 框架

程序名称:Hello.js

授权协议: MIT

操作系统: 跨平台

开发语言: JavaScript

Hello.js 介绍

Hello.js 是一个客户端 JavaScript 框架,用于实现 OAuth2 认证。支持现有多个 OAuth 服务。

示例代码

hello.init({ 
    facebook : FACEBOOK_CLIENT_ID,
    windows  : WINDOWS_CLIENT_ID,
    google   : GOOGLE_CLIENT_ID
},{redirect_uri:'redirect.html'});

hello.on('auth.login', function(auth){

    // call user @R_172_4045@ion, for the given network
    hello( auth.network ).api( '/me' ).then( function(r){
        // Inject it into the container
        var label = document.getElementById( "profile_"+ auth.network );
        if(!label){
            label = document.createElement('div');
            label.id = "profile_"+auth.network;
            document.getElementById('profile').appendChild(label);
        }
        label.innerHTML = '<img src="'+ r.thumbnail +'" /> hey '+r.name;
    });
});

Hello.js 官网

http://adodson.com/hello.js/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐