LoginSignup
0
0

More than 3 years have passed since last update.

【Amplify】Unhandled Rejection (Error): Federation requires either a User Pool or Identity Pool in configの対処法

Posted at

課題

下記のようなエラーが表示される

Unhandled Rejection (Error): Federation requires either a User Pool or Identity Pool in config
AuthClass.<anonymous>
C:/Users/higuz/Documents/src/Auth.ts:1749
  1746 | case 2:
  1747 |     _b.trys.push([2, 6, , 7]);
  1748 |     return [4 /*yield*/, this._oAuthHandler.handleAuthResponse(currentUrl)];
> 1749 | case 3:
       | ^  1750 |     _a = _b.sent(), accessToken = _a.accessToken, idToken = _a.idToken, refreshToken = _a.refreshToken, state = _a.state;
  1751 |     session = new CognitoUserSession({
  1752 |         IdToken: new CognitoIdToken({ IdToken: idToken }),
View compiled
▶ 5 stack frames were collapsed.
onClick
C:/Users/higuz/Documents/fingers-crossed/src/App.js:17
  14 |       <p>
  15 |         Edit <code>src/App.js</code> and save to reload.
  16 |       </p>
> 17 |       <button onClick={() => Auth.federatedSignIn()}>Sign In</button>
     | ^  18 |     </header>
  19 |   </div>
  20 | )

解決策

index.js にconfigを追加する。

index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import Amplify from 'aws-amplify' // 追記
import config from './aws-exports' // 追記
Amplify.configure(config) // 追記
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0