muxinc / mux-php

Official Mux API wrapper for PHP projects, supporting both Mux Data and Mux Video.
MIT License
40 stars 30 forks source link

MuxPhp\ApiException #15

Closed Ebtighaa closed 4 years ago

Ebtighaa commented 4 years ago

Dear All, Hope you are doing well..

am trying to consume php mux api and after following their instructions sharply one by one we received the following exception

Fatal error: Uncaught MuxPhp\ApiException: [401] Client error: POST https://api.mux.com/video/v1/assets resulted in a 401 Unauthorized response: {"error":{"type":"unauthorized","messages":["Unauthorized request"]}} in C:\wamp\www\muxAPI\vendor\muxinc\mux-php\MuxPhp\Api\AssetsApi.php on line 132

anything is just like they said, why we get this error.. knowing that we generated Access Token ID and the Access Token ID

any help..

Thanks in advanced..

philcluff commented 4 years ago

Hey there, thanks for reaching out.

Can you check how you're setting your API keys when you configure the API Client?

We often see people copy/paste their MUX_TOKEN_ID and MUX_TOKEN_SECRET over the username and password in the client initialization, without removing the calls to getenv.

For example:

Incorrect:

    $config = MuxPhp\Configuration::getDefaultConfiguration()
        ->setUsername(getenv('YOUR-TOKEN-ID-HERE'))
        ->setPassword(getenv('YOUR-TOKEN-SECRET-HERE'));

Correct:

    $config = MuxPhp\Configuration::getDefaultConfiguration()
        ->setUsername('YOUR-TOKEN-ID-HERE')
        ->setPassword('YOUR-TOKEN-SECRET-HERE');

Thanks, let me know if that doesn't help!

You can also reach us on help (at) mux.com.

Thanks!

philcluff commented 4 years ago

I'm going to close this issue, but please feel free to reach out to me on the email above if you can't get this working @Ebtighaa

Thanks!

Ebtighaa commented 4 years ago

Dear Sir..

it worked fine for me, thanks

now am asking about how to push live stream to mux..

meaning: i successfully opened my webcam in my browser (inside my web app), how to send this live stream to mux servers using RTMP Protocol, i found multiple apps as solutions for that in mux documentation , one desktop applications for live and one command line program for assets, but i need to do this programmatically in my code..

i hope i clearly explained my request..

Thanks in advanced..

philcluff commented 4 years ago

Hi @Ebtighaa, please can you reach out to us on the help email I provided - GitHub issues should be used for issues with out SDKs only.

Thanks.