Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

query service account

New post

Comments

3 comments

  • cbetta

    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. 

     

    0
    Comment actions Permalink
  • Ali12345

    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 authnticationCustom 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

    0
    Comment actions Permalink
  • Ali12345

    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

    0
    Comment actions Permalink

Please sign in to leave a comment.