我正在使用Firebase通过GitHub、Twitter和Facebook进行身份验证,我知道在进行身份验证时可以获得提供商访问令牌,如下所示
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Facebook Access Token. You can use it to access the Facebook API.
var token = result.credential.accessToken;
// The signed-in user info
我们有一个订购系统,最终用户可以从他们的iOS应用程序订购餐食。每个iOS应用属于一个品牌,每个用户也属于一个品牌。我们把所有的品牌信息放在一个firebase项目中。数据库结构为:
-brands
-- brand_id_1:
-- information
-- brand_id_2:
-- information
-stores
-- store_id_1:
-- brand_id:brand_id_1
-- more information
-- store_id_2:
-- brand_id:brand_id_1
-- more
这是用于登录twitter帐户的代码。我可以登录并被重定向到应用程序,但我无法检索正确的访问令牌( twitter api页面上显示的持有者令牌)。我得到了一个包含访问令牌的AuthDataResult,但当用于进行api调用时,它不起作用。 final class AuthManager{
var isSignedIn:Bool{
return firebase.currentUser != nil
}
static let shared = AuthManager()
var provider:OAuthProvider?
let firebase = Auth.auth
我正在使用Firebase和Facebook登录。我想使用Firebase返回给我的Facebook身份验证令牌来调用Graph API,但是我在文档中找到的惟一的Firebase方法是getRedirectResult()。
firebase.auth().getRedirectResult().then(function(result) {
if (result.credential) {
// This gives you a Facebook Access Token. You can use it to access the Facebook API.
var t
从消防基地的文件
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the
Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
// Handle Er
我有以下代码,它先用Facebook验证用户身份,然后用Firebase验证用户身份:
func authenticateWithFacebook() {
FBSDKLoginManager().logIn(withReadPermissions: ["public_profile"], from: self) { (user, error) in // Signs up user with Facebook
if let error = error {
print(error.localizedDescription)