I'm trying to write some nodejs code to send a notification to an APN.[Apple push notification service]. I seem to have some control over the server code, but I need a device token from the client to get it.
I used this sample code http://samuli.hakoniemi.net/how-to-implement-safari-push-notifications-on-your-website/ To popup a notification, but this Method focusses on creating a pushpackage which again uses a certificate as opposed to an Authentication token.
Platform : MacOS
Browser : Safari
Method : Authentication Token/[Not certificates]
Need help with javascript code for extracting authentication token.
Ok the javascript code finally worked. I was able to get the device token using the same code.
My nginx server where I had the webportal hosted needed some tweaking.
Basically, nginx has an user called www-data which did not have adequate permissions for me to write to a log file.
I used the command
'addgroup www-data'
to provide it necessary permissions.
If I may suggest use the createpushpackage.php to the t. It creates the perfect package and allows you to generate the permission dialogue properly.
Related
Hi I tried this module to communicate with Infusionsoft: https://www.npmjs.com/package/passport-infusionsoft but somehow, when I tried to run it (using the samples on the npm module) by running it here and also on my local node app (same code) nothing happens. Upon reading the documentation: https://developer.infusionsoft.com/authentication/#request-access-token, there are things that are not clear such as:
Once the user has logged into their Infusionsoft account and authorized your application, they will be redirected back to your application at your specified redirect_uri with a code URL parameter that is used to request an access token. Redirect users to https://signin.infusionsoft.com/app/oauth/authorize along with the required parameters in order to start the OAuth exchange.
Based on the steps provided by the documentation and the samples of the node module, how can I use them all together? I apologize since I'm not sure of the entire process. The goal is I need to at least get the token from the Infusionsoft after I submit the clientID and clientSecret. What is the difference of the callback and the redirect URL? If there are more understandable samples, please help me..
I'm developing an app, which should connect to an external DocumentDB database (not mine). The app is build with Cordova/Ionic.
I founda JavaScript library from Microsoft Azure in order to ensure a DocumentDB database connection, but it is asking for some weird stuff like collection_rid and tokens.
I've got the following from the guys of the external DocumentDB database:
Endpoint: https://uiuiui.documents.azure.com:443/
Live DocumentDB API ReadOnly Key: P8riQBgFUH...VqFRaRA==
.Net Connection String: AccountEndpoint=https://uiuiui.documents.azure.com:443/;AccountKey=jl23...lk23==;
But how am I supposed to retrieve the collection_rid and token from this information?
Without row-level authorization, DocumentDB is designed to be accessed from a server-side app, not directly from javascript in the browser. When you give it the master token, you get full access which is generally not what you want for your end-user clients. Even the read-only key is usually not what you want to hand out to your clients. The Azure-provided javascript library is designed to be run from node.js as your server-side app.
That said, if you really want to access it from the browser without a proxy app running on a server, you can definitely do so using normal REST calls directly hitting the DocumentDB REST API. I do not think the Azure-provided SDK will run directly in the browser, but with help from Browserify and some manual tweaking (it's open source) you may be able to get it to run.
You can get the collection name from the same folks who provided you the connection string information and use name-based routing to access the collection. I'm not sure exactly what you mean by token but I'm guessing that you are referring to the session token (needed for session-level consistency). Look at the REST API specs if you want to know the details about how that token gets passed back and forth (in HTTP headers) but it's automatically taken care of by the SDKs if you go that route.
Please note that DocumentDB also provides support equivalent to row-level authorization by enabling you to create specific permissions on the desired entities. Once you have such a permission, you can retrieve the corresponding token, which is scoped to be valid for a certain time period. You would need to set up a mid-tier that can fetch these tokens and distribute to your user application. The user application can then use these tokens as bearer-tokens instead of using the master key.
You can find more details at https://msdn.microsoft.com/en-us/library/azure/dn783368.aspx
https://msdn.microsoft.com/en-us/library/azure/7298025b-bcf1-4fc7-9b54-6e7ca8c64f49
My current project constists of 2 components:
a WCF server application
a purely client-sided (javascript, jQuery, TypeScript etc) website which consumes the service.
When the client saves data to my database via the WCF service, I need to log who made the last modification to that data.
To do this I need the username of the account the client website's browser is running under.
Browser support needs to be:
Chrome
Firefox
IE 10/11.
I don't want to create a login form for my website, I want the user to be able to open the website and be logged on using their Windows/Citrix account.
Javascript can't get to the account username because of security concerns obviously.
Any suggestions?
I have a experimental answer for you. Not sure but posible to work correctly. I think, you can activate impersonation and basic authentication on iis. Then client(browsers) ask credentials to client. In service layer, you can enable impersonation too. but only iis impersonation may enough.
I'm building a chrome extension that facilitates the creation of contacts straight from the browser without needing to go to my devise-powered rails app itself. Contacts#Create requires authentication so I'm wondering how I can do send authenticated requests from the extension.
I've enabled devise TokenAuthenticatable and so my users have an authtoken. I've written a method in my extensions js that posts to my rails app's contacts#create action. For testing, I've simply hard coded my own auth token in, which seems to work. But how can the extension access the auth tokens for users? It doesn't seem right/secure to store this token into a cookie.
I think I'm supposed to use chrome.cookies to access and do something with my app's session info somehow. But I only get a sessionID here.
any help appreciated!
Although not from a chrome extension, I was building something similar that would work from terminal. I ended up bypassing devise and creating by own token authentication that would allow users to access just the one controller#action I needed. That way you can minimize the damage if the token gets stolen.
So anyway, I would allow users to generate (and regenerate) tokens within the rails app interface and make it so that the extension asks for the token on the very first launch. I'd store the token itself in localStorage.
You can also check authentifiation_tokenstored in your app cookie.
You can achieve this using the chrome.cookies.getAll() method detailed here - https://developer.chrome.com/extensions/cookies#method-getAll
I am working on a Azure Web application. The code compiles and runs fine on my local machine. But when I upload the package in Azure Platform, the webrole wouldn't start and gives Busy status with the message: "Waiting for role to start... System is initializing. [2012-04-30T09:19:08Z]"
Both Onstart() and Run() don't contain any code. I am not blocking the return of OnStart.
However I am using window.setInterval in javascript. The javascript function retrieves the values from Database every 10 seconds.
What can be done to resolve this?
In most of the situation when a Role (Web or Worker) is stuck, I have found the following steps very useful:
Always add RDP access to your role because in some cases when role is stuck you still have ability to RDP your instance and investigate the problem by yourself. In some cases you could not RDP to your instance because dependency services are not ready yet to let you in. So if you have RDP enabled or could RDP to your instance please try to log you in.
Once you have RDP to your instance. Get the local machine IP address and launch directly in browser. In internal IP address starts from 10.x.x.x so you can open the browser based on your endpoint configuration i.e. http://10.x.x.x:80 or https://10.x.x.x:443
If you could not get into the instance over RDP then your best bet are to get the diagnostics info to understand where the problem could be. The diagnostics info is collected in your instance and sent to Azure Storage, configured by you in your WebRole.cs (in Web Role) or WorkerRole.cs (in Worker Role) code. Once diagnostics is working in your role, you can collect the Diagnostics data at your configured Azure Blob/Table storage to understand the issue.
If you don't have RDP access and don't have any Azure Diagnostics configured (or could not get any diagnostics data to understand the problem) your best bet is to contact Azure Support team (24x7 via web or phone) at the link below and they will have ability to access your instance (with your permission) and provide you root cause.
https://support.microsoft.com/oas/default.aspx?gprid=14928&st=1&wfxredirect=1&sd=gn
When contacting Azure Support, please provide your Subscription ID, Deployment ID, your Azure Live Account ID and a small description of your problem.
Two things to check:
Make sure your diagnostics connection string is pointing to a real account, and not dev storage
Check the session state provider in web.config. By default, it points to SQL Express LocalDB, which won't exist in Windows Azure.
The reason for this I run into the most is a missing or invalid assembly. But there are several great posts that can help disanosis this so I won't dive into the matter too deeply myself.
http://social.msdn.microsoft.com/Forums/en-US/windowsazuretroubleshooting/thread/6c739db9-4f6a-4203-bbec-eba70733ec16
http://blogs.msdn.com/b/tom/archive/2011/02/25/help-with-windows-azure-role-stuck-in-initializing-busy-stopped-state.aspx
http://blogs.staykov.net/2009/12/windows-azure-role-stuck-in.html