Ortal
Ortal

Reputation: 23

BOX API trying to connect user and grant access to Box

I'm trying to get access to my box app via API, i wrote the following API line in "postman":

https://www.box.com/api/oauth2/authorize?response_type=code&client_id=MY_CLIEN_ID&redirect_uri=https://127.0.0.1

AND THEN I get BOX login window i fill the fields and click on the Authorize button next i get the following box window : "With access to your Box account, "SharingFileSystem"(my app's name) can: Read and write all files and folders" with button "Grant access to box"

when I'm clicking on this button (Grant access to box) i get "The server refused the connection."

What i need to do for connect to the BOX by API successfully?

Upvotes: 0

Views: 523

Answers (2)

Abhinav
Abhinav

Reputation: 39932

You can now use the Postman packaged app version to get access tokens for OAuth 2. Helps you avoid the hassle of setting up a server.

Upvotes: 0

John Hoerr
John Hoerr

Reputation: 8035

Box is trying to redirect you back to a webserver listening on localhost, as you've specified in the request. This is the Handling the Response from Box part of the OAuth2 workflow. You have two options here:

  1. For a web-based application, run a webserver on localhost that can handle the HTTP redirect from Box, or
  2. For a client application, register a custom scheme for your application in your OS. This can be any arbitrary name, e.g. foo. Use that custom scheme in the redirect_uri field of your original request to Box: redirect_uri=foo://bar. Your OS will then send the redirect parameters to your application.

Upvotes: 0

Related Questions