Git Product home page Git Product logo

Comments (10)

Dhavalptel avatar Dhavalptel commented on June 4, 2024 1

Okay, I am closing this issue now I am able to get status, token
Thanks for the help

from bws-gui.

Dhavalptel avatar Dhavalptel commented on June 4, 2024

Thanks, I got it using https://account.bioid.com/connect/token Closing this

from bws-gui.

CmdQ avatar CmdQ commented on June 4, 2024

Great. But also, it seems you miss a space after your "Basic" before appending the base64-encoded stuff.

from bws-gui.

Dhavalptel avatar Dhavalptel commented on June 4, 2024

@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.

Dhavalptel avatar Dhavalptel commented on June 4, 2024

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.

CmdQ avatar CmdQ commented on June 4, 2024

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 and client_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.

Dhavalptel avatar Dhavalptel commented on June 4, 2024

@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.

Dhavalptel avatar Dhavalptel commented on June 4, 2024

@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.

CmdQ avatar CmdQ commented on June 4, 2024

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.

CmdQ avatar CmdQ commented on June 4, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.