1

N.B.初めての投稿ですので、フォーマットミスや質問フォームなどを訂正するのをためらってください。リアクションネイティブ:TypeError:未定義はオブジェクトではありません

私は比較的ネイティブに反応していますが、APIを使用してGoogleシートを変更するアプリを開発しようとしています。私は、OAuth認証(repo-linked-here)を処理するためのパッケージを見つけたが、それは次のエラーを投げているように見える:

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)); 
    } 
... 

が反応ネイティブ-oauthは、コールバックに 'http://localhost/google'を使用し、build.gradleファイルにいくつかの行を追加すると、コールバック/リンクが正常に動作することを示しているようです。

すべてのアドバイスをいただければ幸いです。

答えて

1

私はあなたが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)); 
} 
関連する問題