Currently I'm trying to create a simple login form with Microsoft PowerApps.
I have a login action (Web API2) that is called:
SampleAPI.AuthLogin({UserName:UserNameTextBox.Text, Password:PasswordTextBox.Text})
This is working great. The Login method is returning a json web token which should be passed in all following requests. Is this possible?
Futhermore, when clicking on the Login button, a new screen should appear. (Using Navigate).
So how can I set the result of AuthLogin as the Authentication Header in all following http requests?
Thank you very much!
Yes, this is possible. I'm not sure what aspect of what you are trying to do is causing you grief.
I'm going to guess it is holding on to the json web token that is returned. I'm guessing you would like the equivalent of a global variable to hold this value? PowerApps does not have global variables, but it does have global collections. Use the Collect function to store the value in a collection that you can then access from anywhere in the app. You can view collections in your app with the File menu.
If you don't need a global variable, as a variable scoped to the screen will suffice, then you can use a context variable instead.
Related
I'm using the Xero API to do some calculations on employees. This requires an OAuth2Token, specifically the tenantId and the accessToken. This is gotten by redirecting the user to log in and then providing them with the token
The tenantId is a generic list of Tenant. I grab the token through API means and then I assign it to a variable as a XeroOAuth2Token.
Then I send it as the route value. Using breakpoints I can see that the variable looks fine as it is sent to RedirectToPage.
Yet the immediate OnGet that is called, everything is the same except the TenantList no longer has any members?
The solution to this is to serialize the object and send it as a prop inside an anonymous object, I want to know why I have to do that. Thank you for any insight
i.e, want to submit data to external url and after submitting data external url should open and . and from external url i will receive data
There are vary ways to do this. I'm not giving you code or example of that. Because you will get easily by search. I just give you ways to do that.
Solution 1:
You can store data in cookie and read cookie in any component.
Solution 2:
Make a service and in service make public variable. Import service in component and store data in variable. Now you can access that variable into other component.
Solution 3:
Use the angular feature of passing data between component's to components. Just do some R&D on that you will get easily required stuff to do that.
For more details with example read this link.
Hope it will help you...
So I am trying to find the most direct point to do a 'Get' from an API when a page loads. As an example, if in my app I go to "#/somepage", when I click on the link to do so, it also does a get from "http://{{host}}/api/common/trans/claim". That URI contains a single property with no name that looks like " "Bzc5YUL7dNjK6ApxpNK1XB%2bDtTU8cw7xRSGpjZ4XRuE%3d" ". So if I fire or add some listen event to this, what is the best way to store? I know that might be a seperate question, but legitimate here because of how the data is returned. Hopefully I provided and storied my question correctly.
My queries have pointed to things like viewContentLoaded and DOM readiness, etc..., but those seem overkill for this when simply clicking a link an retrieving info from the API.
Keep in mind, this API is local and private and the URI data is only available until after the user is logged in.
I'm not if I follow your question but you can fire the function using the ng-click directive.
To store the return value you could set it to the $scope of your controller or save it to a service if you'd like to share the data across controllers.
Hi I am new for nopcommerce 3.5. I need to write a restful web service api to third party(for eg mobile) access the service. I know that we can access through Nop.Plugin.Misc.WebServices . I had enable the service from administrator site.
But now is my question. How can i call the web service for eg GetPaymentMethod , product list and etc
And if I want to write my custom web service by using web api. what is step to create? I cant find any documentation about the web service. Please guide me some example
Thanks
If you want a really quick start in writing a web service in NopCommerce, you can follow the MVC architecture and:
Create an Action method inside a Controller that you find appropriate for your purpose. For example, if you want access to a product list, you might create an Action inside CatalogController that follows the logic of the existing ProductList action.
Set up a Route in RouteProvider.cs to point to the Action you created. Based on this route you can deduce the URL of your service.
Do the processing that you need inside the Action. If this Action/service is to be called with parameters (in query string format: param=value¶m2=value2), you can just put these parameters in the Action's header:
public ActionResult QuickService(int param, string param2) { ... and .NET will take care of having them initialized.
Store results in an object (can also be an anonymous object) and at the end of your action, return it as Json: return Json(resultsObject); Again, ASP.NET takes care of the JSON serialization and automatically sets the Content-Type HTTP response header to "application/json".
You can consume the service calling the URL that corresponds to the route of your Action.
If you want users to be able to log in, by using the above method, it gets a little bit trickier. You need the webservice client to be able to accept and send cookies, as well as make appropriate services for Login, Logout, Register,...
However, in this case, you might be better off with a mobile version of the site.
Final note: If you don't want to alter base NopCommerce code, you can apply the steps above to a plugin. The majority of NopCommerce plugins follow the MVC architecture, so you can apply the steps above.
I need to pass one object from my App to webviews html page.
I know we can invoke function of webview's page uusing invokescriptasync and also pass data as parameter. but it takes only string as parameter.
object which I want to pass cannot be serialized. so I need to pass it as it is.
The app and the Webview run in isolated script contexts, thus you are limited to passing information as string properties of the args object given to invokeScriptAsync. This is by design for security reasons, with no means to bypass it; otherwise you open the potential for malicious code in a Webview to directly modify app objects.