elliott-liu / azure-functions-oauth-1.0

Azure Functions script to create an OAuth 1.0 Authorization header. Intended to be used in conjunction with Microsoft Power Automate & Power Apps.
1 stars 0 forks source link

INVALID_LOGIN_ATTEMPT #1

Open ryanlebato opened 2 years ago

ryanlebato commented 2 years ago

I am trying to implement this with netsuite and power automate. The authorization header runs successfully, however my actual GET request fails saying INVALID_LOGIN_ATTEMPT.

I have made a few tweaks to the signature by adding realm and changing the signature method to 'HMAC-SHA256' as this is what I am using.

$SignatureParams = @{ 'realm' = '7640830'; 'oauth_consumer_key' = $OAuth.ApiKey; 'oauth_token' = $OAuth.AccessToken; 'oauth_signature_method' = 'HMAC-SHA256'; 'oauth_nonce' = $OauthNonce; 'oauth_timestamp' = $OauthTimestamp; 'oauth_version' = '1.0'; }

I tested with the exact same credentials in PostMan and it works. I can also see that my headers between PostMan and PowerAutomate are exactly the same (except for the nonce and timestamp)...

derekngibbs commented 1 year ago

I'm having the same issue. Did you ever figure out the issue?

Uthoocha commented 11 months ago

I am looking for a solution to use Power Automate to post Data from Dynamics into Netsuite. I feel like i have followed several people around the net to find nothing but dead ends. From this post_ https://mgr.medium.com/how-to-connect-to-netsuite-from-microsoft-power-automate-using-oauth-1-0-1d7670972406 to this post https://powerusers.microsoft.com/t5/Using-Connectors/NetSuite-Custom-Connector-via-OAuth-2-0/td-p/590277

At this point I would just like to know if anyone has actually achieved this and is it work me trying to implement any of this older proposed solutions. OR has time and updates provided solutions now, which means Power Automate HTTP Action will just work with Netsuites OAUTH2 suitetalk API and tockens refresh etc.

Does anyone know?

kgrindstaff commented 3 months ago

I am having the exact same issue. Getting the Invalid Login Attempt error from NetSuite. Postman works great but cannot get Power Automate to work using the Azure Function App that was provided. I am not sure what is missing but the Authorization header seems to be the same as Postman so I assume it has something to do with the signature creation. Has anyone figured out how to make this work?

Uthoocha commented 3 months ago

I actually managed to build a solution that works with Power Automate (PA), but it was a pain in the a s s!

I had to use a C# Azure Function to do the authorisation, (Shout out to Eric Popivker for the C# part, whoever you are) https://medium.com/entech-solutions/how-to-use-netsuite-rest-api-with-oauth-2-and-c-net-126ac118919c The SSL Cert was a bit tricky, but there are some good videos on how to do it https://www.youtube.com/watch?v=Ug2ZtI8wCDg this one was the best (Also linked by Eric P.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-your-first-function-visual-studio

I used a CRON flow to call this function every 15 mins, get the token and store it in PA as environmental variable, which I can then use in other flows to pass and pull data from NS using http block.

between these videos and Chat GPT to take the C# functions above, paste all the classes into an Azure C# functions, and join them together, I made a pretty slick solution that has not failed us yet. Pushing Orders from Dynamics into Netsuite on Fulfilment. Not bad for someone who is not a Dev, could not have done it without Eric Popivker's C# function.

But oAuth 2 Machine to Machine is a must with NS and PA, you're wasting your time trying to use oAuth 1 as the Token will time out after 1 week even if you do mange to make it work, a human still needs to re authorise it once a week, which is not a good solution for automation.

kgrindstaff commented 3 months ago

I actually managed to build a solution that works with Power Automate (PA), but it was a pain in the a s s!

I had to use a C# Azure Function to do the authorisation, (Shout out to Eric Popivker for the C# part, whoever you are) https://medium.com/entech-solutions/how-to-use-netsuite-rest-api-with-oauth-2-and-c-net-126ac118919c The SSL Cert was a bit tricky, but there are some good videos on how to do it https://www.youtube.com/watch?v=Ug2ZtI8wCDg this one was the best (Also linked by Eric P.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-your-first-function-visual-studio

I used a CRON flow to call this function every 15 mins, get the token and store it in PA as environmental variable, which I can then use in other flows to pass and pull data from NS using http block.

between these videos and Chat GPT to take the C# functions above, paste all the classes into an Azure C# functions, and join them together, I made a pretty slick solution that has not failed us yet. Pushing Orders from Dynamics into Netsuite on Fulfilment. Not bad for someone who is not a Dev, could not have done it without Eric Popivker's C# function.

But oAuth 2 Machine to Machine is a must with NS and PA, you're wasting your time trying to use oAuth 1 as the Token will time out after 1 week even if you do mange to make it work, a human still needs to re authorise it once a week, which is not a good solution for automation.

Thank you for responding! I will take a look at this and see if I can make it work.