query service account
Hello Experts,
Actually I am a ServiceNow Developer and trying to integrate SNOW and BOX with rest API.
While my initial research I found that I need to create a application in BOX and using those Client ID and Client secrete credentials I can access my account. This appplication is like bridge between SNOW(external application) and BOX. I am using standard OAuth2 method for authentication.
I was able to connect to BOX and create/update folder using API. But as I have authenticated the BOX account while integrating, created folder is showing owner as my name.
I want it to be created with another Admin account. I know while going to production, I can authenticate this integration with that admin account and created folder will have owner as that admin as required.
But I have seen somewhere mentioned about service account. What exactly is service account ? Is it a kind of user account in BOX which can be used for API integration? How to create service account in BOX? where can I see existing service accounts in my BOX application ?
I am new to BOX. Please help me out.
Thanks,
Ali
-
Hi Ali,
Think of the service account as the user account representing the app itself. Every app has a service account attached to it:
https://developer.box.com/docs/service-account
When you authenticate as a user through OAuth2, the access token you end up with is tied to that user, not to the service account. The simplest way to authenticate as the app (as the enterprise really) is to do this is through our SDKs to get an Application Authentication Client for the "enterprise". For example in Node:
sdk.getAppAuthClient('enterprise');
Usage will differ per SDK.
-
Hello,
Thank you for your response.
I may not be able to use SDK as I want this functionality in ServiceNow. To use SDK again it is complex thing as I need to configure node.js (or similar) in our MID server, trigger this SDK from MID server to get the access code and then use that access code in rest call.
I was able to get an access token for my custom app with client credentials only (client id and client secrete).
Custom application with standard OAuth authntication
Now if I try to send any rest call with that access token I am getting 404 not_found error.
what I am missing here?
Thanks,
Ali
-
Hello,
Apologies. Just now got the answer to above query.
Are service accounts available within a standard OAuth 2 application?
No, a standard OAuth 2 application is constructed to connect directly to a managed user account (an account that has the ability to log into the Box web app). The token that is generated when a user goes through the OAuth 2 login and application permission grant screens will be scoped only to that user. No service account is created or available through standard OAuth 2 applications, only with OAuth / JWT.so now I need to create a new custom app or edit existing one to say user OAuth/JWT as authentication method.
so with this JWT, Whatever access token I will get, that would be tied to enterprise app (Nedd to set the application access as Enterprise in my custom app) . using that I can perform any rest call (create folder,create collaborations etc) correct?
But main roadblock for me is I want this JWT implementation in JavaScript (as ServiceNow uses Javascript). Is there any help I can get regarding this?
Thanks,
Ali
Please sign in to leave a comment.
Comments
3 comments