Skip to content

Instantly share code, notes, and snippets.

@lolgolflol
Created October 25, 2018 04:01
Show Gist options
  • Save lolgolflol/e01fb8be8824839d000f2dc86328efd4 to your computer and use it in GitHub Desktop.
Save lolgolflol/e01fb8be8824839d000f2dc86328efd4 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
)
func main() {
sess := session.Must(session.NewSession())
// svc := cognitoidentity.New(sess)
svc := cognitoidentityprovider.New(sess)
destinationUser := &cognitoidentityprovider.ProviderUserIdentifierType{
// ProviderAttributeName: aws.String("Cognito_Subject"),
ProviderAttributeValue: aws.String("bd58ac3d-9086-4400-9797-4e63c21b61d2"),
ProviderName: aws.String("Cognito"),
}
sourceUser := &cognitoidentityprovider.ProviderUserIdentifierType{
ProviderAttributeName: aws.String("Cognito_Subject"),
ProviderAttributeValue: aws.String("1884836704897205"),
ProviderName: aws.String("Facebook"),
}
adminLinkProvide := &cognitoidentityprovider.AdminLinkProviderForUserInput{
DestinationUser: destinationUser,
SourceUser: sourceUser,
UserPoolId: aws.String("ap-southeast-1_DgeeVTPVU"),
}
result, err := svc.AdminLinkProviderForUser(adminLinkProvide)
if err != nil {
fmt.Println(err.Error())
}
fmt.Printf("%#v", result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment