Amplify-js: Hosted UI log out -- missing redirect_uri parameter??

Created on 27 Dec 2018  路  5Comments  路  Source: aws-amplify/amplify-js

Describe the bug

I've been working on integrating Cognito Auth into a web app. We decided to use the Hosted Login UI, and are using @aws-amplify/Auth

Auth.signOut worked at one point, but is now leading to an error page:

Required String parameter 'redirect_uri' is not present

To Reproduce
Steps to reproduce the behavior:

  1. Set up Hosted Auth (https://aws-amplify.github.io/docs/js/authentication#using-amazon-cognito-hosted-ui)
  2. Login Action -> Navigate to Hosted UI
  3. Successful Login -> Redirect back to app
  4. Log out -> Hosted UI

At this point, I'm seeing an error screen. The URL Amplify is trying to send me to to is https://<oauth.domain>/logout?logout_uri=<oauth.redirectSignOut>&client_id=<userPoolWebClientId>

If I return back to my app, I am not logged out.

Expected behavior

I expect to be redirected to the sign out redirect configured in oauth.redirectSignOut, and to be signed out.

Screenshots

screen shot 2018-12-23 at 11 15 49 am

Desktop (please complete the following information):

  • OS: Mac OS 10.14.1
  • Browser Chrome
  • Version 71

Additional context

https://docs.aws.amazon.com/cognito/latest/developerguide/logout-endpoint.html describes the logout page, and has an example that looks just like this url

Did something change? Is this a bug with Cognito?

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = 'DEBUG'; in your app.

I see these logs right before navigating to /logout:

[INFO] 21:43.314 Cache - Remove item: key is federatedInfo
[DEBUG] 21:43.317 AuthClass - user sign out <CognitoUser>
Auth investigating

Most helpful comment

@powerful23 @nason I was just now running into the exact same thing... after a little more research, I determined that you need to set the "Sign out URL" in the Amazon Cognito Console. Choose User Pools, select your pool, go to App Integration, App client settings. Make sure to set the sign-in/out urls for the WEB app client.

It's all working smoothly now. Hope this helps.

All 5 comments

@nason hi, based on the error message, can you verify that you passed the redirectSignOut option in your oauth config?

Hi @powerful23, yes the redirectSignOut property is being passed, and is a value that has been configured as an allowed sign out url for the app client

I've stepped away from this task for the holidays, but will be getting back to this work next week. I'll update this issue if I am able to get further.

@powerful23 @nason I was just now running into the exact same thing... after a little more research, I determined that you need to set the "Sign out URL" in the Amazon Cognito Console. Choose User Pools, select your pool, go to App Integration, App client settings. Make sure to set the sign-in/out urls for the WEB app client.

It's all working smoothly now. Hope this helps.

Hello everyone, we have created an RFC for feature work that should make the challenges found in this issue easier in the future. If you have a moment please read through the details and add any comments: https://github.com/aws-amplify/amplify-js/issues/2716

Your feedback in the RFC will help us ensure that we are delivering the best experience possible. Thank you.

Closing the issue. Please let us know if you have further concern.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

callmekatootie picture callmekatootie  路  3Comments

ddemoll picture ddemoll  路  3Comments

TheRealRed7 picture TheRealRed7  路  3Comments

cosmosof picture cosmosof  路  3Comments

lucasmike picture lucasmike  路  3Comments