I want to set up the login trigger which triggers when user login in the system.
My Login API validate header with following data.
Header:
{
"tenant-id": "{{tenant_id}}",
"event-id": "{{event_id}}",
"Api-Key": "{{api_key}}",
"Device-id": "{{device_id}}"
}
Body:
{
"email" : "{{email}}",
"Password": "{{pwd}}"
}
While testing the trigger it always throwing 500 internal server error. But when I am testing my API with POSTMAN it is working great.
I am not sure where I am doing wrong.
Please help. Thanks.
Related
Question
How would we test a Doorkeeper oauth2 implementation for a Zapier cli app?
Background
I have a Rails 3 app. I am trying to create a Zapier client for the application and I decided to use OAuth. Thus I configured doorkeeper to generate a JWT. All looks good, I am able to authorize and get token using the redirects.
I am not sure how to test the app purely through the console. Wouldn't it require some way to authorize using username/password?
I got an app generated from the template with some minor differences.
it('can fetch an access token', (done) => {
const bundle = {
inputData: {
// In production, Zapier passes along whatever code your API set in the query params when it redirects
// the user's browser to the `redirect_uri`
code: 'one_time_code',
subdomain: 'ducks'
},
environment: {
CLIENT_ID: process.env.CLIENT_ID,
CLIENT_SECRET: process.env.CLIENT_SECRET
}
};
appTester(App.authentication.oauth2Config.getAccessToken, bundle)
.then((result) => {
result.access_token.should.eql('a_token');
result.refresh_token.should.eql('a_refresh_token');
done();
})
.catch(done);
});
results in something like this:
1) oauth2 app can fetch an access token:
Got 401 calling POST https://ducks.<domain>.com/oauth/token, triggering auth refresh.
What happened:
Starting POST request to https://ducks.<domain>.com/oauth/token
Received 401 code from https://ducks.<domain>.com/oauth/token after 1425ms
Received content "{"error":"invalid_request","error_description":"The request is missing a required parameter, include"
Got 401 calling POST https://ducks.<domain>.com/oauth/token, triggering auth refresh.
Which should be because the user is not logged in the request made in the test console...
How can I make the user login? Or should the tests be changed?
I am integrating Yodlee MFA in my application but I am facing difficulties to render MFA form when any MFA errors occurred.
So Steps I follow:
The user selects MFA form say, Dag Site SecurityQA.
The user enters username and password and waits for MFA authentication.
MFA form renders to site and user enters wrong credentials
User receives refresh response with error code 523
Now user tries to refresh the site.
Here I get refresh response as,
{
"siteRefreshStatus"=>{
"siteRefreshStatusId"=>10,
"siteRefreshStatus"=>"SITE_CANNOT_BE_REFRESHED"
},
"siteRefreshMode"=>{
"refreshModeId"=>1,
"refreshMode"=>"MFA"
},
"updateInitTime"=>0,
"nextUpdate"=>2104528345,
"code"=>523,
"suggestedFlowReason"=>{
"suggestedFlowReasonId"=>2,
"suggestedFlowReason"=>"ACCOUNT_IN_ERROR"
},
"suggestedFlow"=>{
"suggestedFlowId"=>3,
"suggestedFlow"=>"EDIT"
},
"itemRefreshInfo"=>[
{
"memItemId"=>xxxxxx,
"itemSuggestedFlow"=>{
"suggestedFlowId"=>3,
"suggestedFlow"=>"EDIT"
},
"itemSuggestedFlowReason"=>{
"suggestedFlowReasonId"=>2,
"suggestedFlowReason"=>"ACCOUNT_IN_ERROR"
},
"errorCode"=>523,
"retryCount"=>4
},
{
"memItemId"=>xxxxxx,
"itemSuggestedFlow"=>{
"suggestedFlowId"=>3,
"suggestedFlow"=>"EDIT"
},
"itemSuggestedFlowReason"=>{
"suggestedFlowReasonId"=>2,
"suggestedFlowReason"=>"ACCOUNT_IN_ERROR"
},
"errorCode"=>523,
"retryCount"=>4
}
],
"noOfRetry"=>4,
"isMFAInputRequired"=>true,
"siteAddStatus"=>{
"siteAddStatusId"=>15,
"siteAddStatus"=>"ADD_FAILURE"
},
"memSiteAccId"=>xxxxxx,
"lastRefreshCompleteTime"=>1482460665
}
which says its MFA account.
I want to open MFA authentication form for this.
But when I try to fetch MFA form using /jsonsdk/Refresh/getMFAResponseForSite API,
It doesn't give me MFA form details but gives following response.
{"isMessageAvailable"=>false, "timeOutTime"=>150000, "itemId"=>0, "errorCode"=>508, "memSiteAccId"=>xxxxxx, "retry"=>false}
Even after waiting after 5-10 mins, I get the same response for MFA form.
The user needs to go for change credentials to resolve this.
Does any work on this? I directly want to open MFA form if the response has MFA-related errors.
We recommend you to please use our new Rest(Yodlee) API. Yodlee API's Swagger Tool
As you are using Rest Wrapper please follow these steps:
Please update your Step-5 with this-> Call updateSiteAccountCredentials API, then poll getMFAResponseForSite to get the MFA login form information.
When you will get "isMessageAvailable=true" in getMFAResponseForSite API's response then stop polling the API and build MFA login form accordingly.
Regards
Saurabh
I am getting the following error while trying to register a user for the Twilio Voice client:
[ERROR VoiceClient] Inside register:deviceToken:completion:, failed to register for Twilio push notifications. Error:Failed to register. Code: 6.
Here is the setup:
Push credentials have been registered with Twilio. A VoIP Push certificate has been registered and those kind of pushes are only in Production mode. Let's say the app ID is "com.bundle.appIDX".
The server side has been setup so that the correct push credentials are fed to the IpMessagingGrant object.
At the client side, the following piece of code is executed:
VoiceClient.sharedInstance().register(withAccessToken: self.accessToken, deviceToken: self.voipToken)
This immediately fails with the error above.
Using version '=2.0.0-beta4' for TwilioVoiceClient, and using version '2.9.1' for twilio-node server side component (https://github.com/twilio/twilio-node/tree/2.9.1).
Tried playing with "Use this credential for sending to a sandbox APN" option and no result.
Tried using both development and provisioning profiles at the client side for the app ID "com.bundle.appIDX".
Is Twilio really supporting VoIP pushes? If yes, what could be wrong with this setup?
Thanks,
Guven.
=======
Edit after Viktor's guidance:
I now manually create the VoiceGrant. I set the value of the key property to 'voice'. Here is what the grant looks like:
{
outgoing_application_sid: 'APXX',
push_credential_sid: 'CRXX',
endpoint_id: 'XX'
}
Still getting the registration error.
I have also tried this format since this is how it looks in 2.11.0 version:
{ outgoing: { application_sid: 'APXX' },
push_credential_sid: 'CRXX',
endpoint_id: 'XX'
}
Any ideas where the problem might be? Attaching the cloud code as well:
var accessToken = new twilio.AccessToken("ACXX", "SKXX", "PPXX", accessTokenOptions);
var voiceGrantConfig = {"outgoingApplicationSid": "APXX",
"endpointId": clientName,
"pushCredentialSid": "CRXX"};
var voiceGrant = new VoiceGrant(voiceGrantConfig);
voiceGrant.key = "voice";
console.log(voiceGrant.toPayload());
accessToken.addGrant(voiceGrant);
var token = accessToken.toJwt();
Edit 2: I have actually upgraded to twilio-node 2.11.0 and still getting the error. Here is the access token right before generating the jwt.
AccessToken {
accountSid: 'ACXX',
keySid: 'SKXX',
secret: 'PPXX',
ttl: 86400,
identity: undefined,
nbf: undefined,
grants:
[ VoiceGrant {
outgoingApplicationSid: 'APXX',
outgoingApplicationParams: undefined,
pushCredentialSid: 'CRXX',
endpointId: 'XX' } ] }
[Edited based on feedback from Guven]
You need a "voice" grant. Otherwise your requests will be denied to the Voice product. You either need to manually add that section to the JSON before signing it or you need to upgrade to the 2.11.0 version. Specifically your token needs to look like this:
{
"sub": "ACxxxx",
"iss": "SKxxxx",
"grants": {
"voice": {
"outgoing": {
"application_sid": "APxxxx"
},
"push_credential_sid": "CRxxxxx"
},
"identity": "voice_test"
},
"jti": "SKxxxxx",
"exp": 1479315711
}
Note, also the "identity" element as well. This is the identifier of your user. Typically its username or an ID of the user record in your system.
Checkout the quickstart app for a code sample for generating the right token (it's in Python but should give you a good idea of how to get started).
I am developing an iOS application for a store on BigCommerce.com . I have successfully retrieved the products list from the BigCommerce API and I have also created a new user using the same.
Create User: https://developer.bigcommerce.com/api/stores/v2/customers#create-a-customer
Product List:
https://developer.bigcommerce.com/api/stores/v2/products
But i am unable to understand that how should i login into the BigCommerce Store as a customer to purchase products listed.
Please can anyone help.
You can login by sending a POST to:
/remote.php?w=expressCheckoutLogin
Send fields 'login_email' and 'login_pass' in your POST's body.
Its very hard to finding login api in bigCommerce. this solution is 100% working and tested.
Keep Enjoy
APi URL : https://api.bigcommerce.com/stores/[STORE_HASH]/v2/customers/[CUSTOMER_ID]/validate
Method : POST
Header
X-Auth-Client : Client_id
X-Auth-Token : Access Token
Accept : application/json
Content-Type : application/json
Body
{
"password": "123456"
}
Response
{
"success": true
}
Key manager setup for my Doorkeeper based provider in oauth is to use client-side(token), which I believe it should use response_type=token when request to /oauth/authorize on provider. But it use response_type=code instead.
And Oauthd generate following error when I click Try auth button:
Internal error {
"body": {
"code": "InternalError"
}
}
Please help. Thanks