Comments (10)
Okay, I am closing this issue now I am able to get status, token
Thanks for the help
from bws-gui.
Thanks, I got it using https://account.bioid.com/connect/token
Closing this
from bws-gui.
Great. But also, it seems you miss a space after your "Basic" before appending the base64-encoded stuff.
from bws-gui.
@CmdQ But accessing with https://account.bioid.com/connect/token
does not require basic authentication
$uriBase = 'https://account.bioid.com/connect/token';
//set the request header
$requestHeaders=[
'Content-Type' => 'application/x-www-form-urlencoded',
];
//set the body params
$requestParams=[
'client_id'=>env('BIOID_CLIENT_ID'),
'grant_type'=>'client_credentials',
'client_secret'=>env('BIOID_CLIENT_SECRET')
];
//send the request to BIOID server and return the response
$response = $this->client->post($uriBase,[
'headers'=>$requestHeaders,
'form_params' =>$requestParams,
]);
return json_encode(json_decode($response->getBody()->getContents()), JSON_PRETTY_PRINT);
from bws-gui.
Though, I am also having the issue with Upload API
with the following error
"Message":"The API call requires authentication. Try to request a Web Token before calling this method."
$uriBase = 'https://bws.bioid.com/extension/upload';
$imageUrl = 'https://upload.wikimedia.org/wikipedia/commons/3/37/Dagestani_man_and_woman.jpg';
//send the request to BIOID server and return the response
$response = $this->client->post($uriBase,[
'query'=>['tag'=>'up'],
'headers'=>['Authorization' => 'Bearer '. $request->token],
'form_params'=>['image' =>base64_encode($imageUrl)]
]);
return json_encode(json_decode($response->getBody()->getContents()), JSON_PRETTY_PRINT);
from bws-gui.
Disclaimer: I don't know much about PHP and cannot try your samples.
What I see:
- Yes, the token call does need basic auth.
- Why do you use
application/x-www-form-urlencoded
? It is not understood by the token call. Only a few of our calls understand that one. - Where do you get the parameter names
client_id
,grant_type
andclient_secret
from?
See the token documentation about the two mandatory parameters (all via GET!) and authorization. Also you can find a sample response. Check that yours looks similar.
Your first try was much better, you just forgot the space between βBasicβ and the base64-encoded string.
from bws-gui.
@CmdQ Thanks for the reply, I have added space between basic and base64-encoded string but still, it's throwing "Message":"Unauthorized"
from bws-gui.
@CmdQ Though I was trying to access status [https://developer.bioid.com/bwsreference/web-api/web-status-api] but still that is throwing Unauthorized
from bws-gui.
At the moment I can only tell you to double-check the spelling/casing of your app id and secret. I just tried changing a tiny bit and got to the same error message as you.
Maybe try status first. It does not need any parameters, so one less thing to go wrong. Authorization is the same.
from bws-gui.
Oh, now I see something else: you tried to get the token from https://account.bioid.com/connect/token. That is our user management and that token is of no use to you.
If you want to call
https://bws.bioid.com/extension/upload
then you need to get your token at
https://bws.bioid.com/extension/token
Same prefix for all calls!
Again, your first try was the most correct.
from bws-gui.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bws-gui.