PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 16, 2022

[FIXED] Why is my amplify federated sign-in in react native adding an extra 'https'?

 July 16, 2022     amazon-cognito, aws-amplify, facebook-login, google-signin, react-native     No comments   

Issue

I am using a manual auth configuration in my react native app to add OAuth to my react native app. I have followed all of the steps outlined here for Google and Facebook.

My problem is when I click on the button I have created in the front-end that redirects me to a federated sign-in, there is an extra 'https' in the link.

In AWS Cognito User Pools, my sign in and sign out URLS are set to myapp:// and have configured my hosted UI in the AWS console. I have also set the hosted UI url to the OAuth Redirect URI's in both facebook and google for my app clients.

This is my aws configuration in react native:

export default awsConfig = {
    Auth: {
      "aws_project_region": "us-west-2",
      identityPoolId: 'us-east-1:*******',
      region: 'us-east-1',
      userPoolId: '************'
      userPoolWebClientId: '*************'
      oauth: {
        domain: "https://myapp.auth.us-east-1.amazoncognito.com",
        scope: [
            "email",
            "openid",
        ],
        redirectSignIn: process.env.NODE_ENV === "myapp://",
        redirectSignOut: process.env.NODE_ENV === "myapp://",
        responseType: "code"
      },
      federationTarget: "COGNITO_USER_POOLS"
    }
}

In my case, the problem occurs when I click either the "Sign in with Facebook" or "Sign in with Google" buttons.

iOS React Native App

This is what comes up when I click either link:

Safari cannot open page

and the whole url is https://https//aspen-dev.auth.us-east-1.amazoncognito.com/oauth2/authorize?redirect_uri=false&response_type=code&client_id=****&identity_provider=Google&scope=email%20openid&state=****&code_challenge=xQX-****&code_challenge_method=S256

As you can see, there is an extra https, and I don't know what is causing it.


Solution

in awsConfig, I took out the 'https://' of the oauth.domain and now it is working



Answered By - Dane B
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing