Google/Firebase 身份验证没有适用于 iOS 的 displayName 或 photoURL [英] Google/Firebase Authentication no displayName or photoURL for iOS

查看:16
本文介绍了Google/Firebase 身份验证没有适用于 iOS 的 displayName 或 photoURL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Ionic2 和

config.xml

<?xml 版本='1.0' 编码='utf-8'?><widget id="com.ionicframework.XXXXXXX" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>theWhoZoo</name>

而且它也有 REVERSED_CLIENT_ID 匹配上面的 iOS URL scheme.

<插件名称="cordova-plugin-googleplus" spec="~5.1.1"><变量名=REVERSED_CLIENT_ID"值=com.googleusercontent.apps.XXXXXX"/></插件>

我还为我的项目创建了一个 Firebase App,它也具有匹配的 Bundle ID(不确定这是否有任何影响):

另外,我不确定这是否有任何区别,但我将 iOSCLIENT_ID 添加到 Google Firebase 身份验证中:

问题

在为 iOS 进行设置时,我是否遗漏了任何步骤或做错了什么?

解决方案

这应该添加获取配置文件数据所需的范围:

window.plugins.googleplus.login({范围":https://www.googleapis.com/auth/plus.me",//下面继续...

查看官方文档和插件文档了解详情.

此处描述了范围.

I am using Ionic2 and GooglePlus Authentication.

I can sign in and it creates a User with a uid in the Firebase Authentication list as expected.

When I do this:

        GooglePlus.login({
            'webClientId': webClientId,
            'offline': true
        }).then(googleData => {

Where the webClientId matches the Client ID in the iOS Credential below.

Problem:

However, for iOS, the googleData does contain an emailAddress and uid, but the displayName and photoURL are null.

More Info:

I do have an iOS Credential set up with the Bundle ID matching the widget id in the config.xml:

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.ionicframework.XXXXXXX" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>theWhoZoo</name>

And it also has the REVERSED_CLIENT_ID matching the iOS URL scheme above.

<plugin name="cordova-plugin-googleplus" spec="~5.1.1">
    <variable name="REVERSED_CLIENT_ID" value="com.googleusercontent.apps.XXXXXX" />
</plugin>

I have also created a Firebase App for my Project that also has the matching Bundle ID (not sure if this has any effect):

Also, I am not sure if this makes any difference, but I add the the CLIENT_ID for iOS to the Google Firebase Authentication here:

Question

Are there any steps I am missing or doing something wrong to set this up for iOS?

解决方案

This should add the required scope for fetching profile data:

window.plugins.googleplus.login({
  'scopes': 'https://www.googleapis.com/auth/plus.me',
  // continue below...

See the official documentation and the plugin documentation for details.

The scope is described here.

这篇关于Google/Firebase 身份验证没有适用于 iOS 的 displayName 或 photoURL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆