Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client = Aws::CognitoIdentityProvider::Client.new(
- access_key_id: "xxxx",
- secret_access_key: "xxxx",
- region: "us-east-1"
- )
- # Base64 ( HMAC_SHA256 ( "Client Secret Key", "Username" + "Client Id" ) )
- username = "dinesh16@gmail.com"
- key = App_client_secret # (get this from amazon cognito console)
- data = username + App_client_id # (get App_client_id from amazon console)
- secret_hash = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key, data)).strip
- resp = client.sign_up({
- client_id: "xxx", # required
- secret_hash: secret_hash,
- username: username, # required
- password: "AbCdEpoioQ!", # required
- user_attributes: [
- {
- name: "email", # required
- value: "dinesh16@gmail.com",
- },
- ],
- analytics_metadata: {
- analytics_endpoint_id: "StringType",
- },
- user_context_data: {
- encoded_data: "StringType",
- },
- })
Add Comment
Please, Sign In to add comment