反应本性:TypeError:未定义不是对象



n.b。第一次发布,所以请不要犹豫,纠正格式错误,问题表等。

我对反应生态相对较新,但是尝试构建一个使用其API对Google表进行更改的应用程序。我找到了处理OAuth身份验证的软件包(repo-c-C-链接(,但似乎正在抛出以下错误:

TypeError: undefined is not an object (evaluating 'Module[fn]')

这是我的大多数index.android.js:

...
import OAuthManager from 'react-native-oauth';
const manager = new OAuthManager('App');
export default class App extends Component {
  constructor(props){
    super(props);
    this.state = {
      isSignedIn: false
    };
  }
  componentDidMount(){
    manager.configure({
      google: {
        callback_url: 'http://localhost/google',
        client_id: '*************',
        client_secret: '************'
      }
    })
    .then(resp => console.warn(resp))
    .catch(err => console.warn(err));
  }
...

React-Native-Oauth似乎表明,如果我使用'http://localhost/google'进行回调,并在build.gradle文件中添加几行,则回调/链接应该正常工作。p>所有建议都将不胜感激!

我认为您不是从manager调用authorize。另外,您不能添加then&catchconfigure

componentDidMount(){
  manager.configure({
    google: {
      callback_url: 'http://localhost/google',
      client_id: '*************',
      client_secret: '************'
   }
  });
  manager.authorize('google', {scopes: 'profile email'})
  .then(resp => console.warn(resp))
  .catch(err => console.warn(err));
}

也许其他人遇到了这个问题。我也有此错误消息,花了很多时间来找到任何解决方案,没有一个基础的答案可以解决我的问题。问题既不是配置也不是授权。运行时(CD iOS&& pod install(,然后尝试链接其要求您覆盖Pods文件。是的。我通过从Xcode运行应用程序找到了它,然后获取错误消息,例如:

framework not found DCTAuth

然后谷歌搜索,发现它与PODS文件有关。希望这对某人有帮助。

最新更新