Skip to content

Sending Unique ID to Presignup_ExternalProvider triggersource is not showing up in validationData object of event.request

0

Hi, My app needs to restrict the user no more than one registration from mobile device. This is true for both custom registration process and via social login (currently using AWSMobileClient.default().showSignIn()). Below is the code sample which I have coded for swift let hostedUIOptions:HostedUIOptions? let signInQueryParam = ["data": "hjhjhjhh"] switch socialLoginType { case .apple:hostedUIOptions = HostedUIOptions(identityProvider: kLoginWith_Apple,signInURIQueryParameters: signInQueryParam) break case .google:hostedUIOptions = HostedUIOptions(identityProvider: kLoginWith_Google,signInURIQueryParameters: ["myCustomData": "customValue"]) break case .facebook:hostedUIOptions = HostedUIOptions(identityProvider: kLoginWith_Facebook,signInURIQueryParameters: signInQueryParam) break default:hostedUIOptions = HostedUIOptions(identityProvider: kLoginWith_Google,signInURIQueryParameters: signInQueryParam) break }

    // Present the Hosted UI sign in.
    AWSMobileClient.default().showSignIn(navigationController: vc.navigationController!, hostedUIOptions: hostedUIOptions) { (userState, error) in{}}

I was able to see the parameter in /authorize.

However, I could not see signInQueryParameters in presignup lambda trigger. is there anyway, I can send custom param from client to presignup trigger in social login signup flow

1 Answer
0

you can send custom parameters from the client to the PreSignUp_ExternalProvider Lambda trigger in a social login signup flow.

In your client code, when calling the showSignIn method, you can add a custom parameter to the signInURIQueryParameters dictionary

let signInQueryParam = ["myCustomData": "customValue"]
let hostedUIOptions = HostedUIOptions(identityProvider: kLoginWith_Google, signInURIQueryParameters: signInQueryParam)

AWSMobileClient.default().showSignIn(navigationController: vc.navigationController!, hostedUIOptions: hostedUIOptions) { (userState, error) in
    // Handle the sign in result
}

In the PreSignUp_ExternalProvider Lambda function, you can access the custom parameter in the validationData object of the event.request object

exports.handler = async (event, context) => {
    // Get the custom parameter from the validationData object
    const customParam = event.request.validationData['myCustomData'];
    
    // Do something with the custom parameter
    
    // Return the event object
    return event;
};
EXPERT
answered 3 years ago
  • @sdtslmn I have tried this approach and my problem statement mentioned exactly the approach suggested by you. Still could not receive the value. I am using 2.22.0 version of ios SDK

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.