Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth for the Web API #6

Closed
lucasstark opened this issue Sep 10, 2018 · 7 comments
Closed

OAuth for the Web API #6

lucasstark opened this issue Sep 10, 2018 · 7 comments
Labels
wontfix This will not be worked on

Comments

@lucasstark
Copy link

I'm wondering if OAuth for the Web API can be used here, and if so, any example of how one might get started doing that would be greatly appreciated!

Basically looking for the PHP version of: https://msdn.microsoft.com/en-us/library/gg327838.aspx

Thanks in advance.

@georged
Copy link
Contributor

georged commented Sep 11, 2018

@lucasstark you are referring to OAuth client authentication, which is not quite the purpose of the library. While we may add that in the future, in the initial release we primarily target S2S authentication which uses client credentials grant.

However, you can provide your own implementation of OnlineAuthMiddleware implementation with authorisation code grant, which looks like what you're after. You can try using existing third-party libraries, e.g. OAuth2.

HTH
George

@SynedatPranke
Copy link

@georged: May I ask, how much time do you need to implement this feature? From my humble understanding it seems this feature is quite important on business level, if your company uses features like SSO for all internal webapps.

@georged
Copy link
Contributor

georged commented Apr 28, 2019

@SynedatPranke it's not the question of time, it's the question of supply and demand. Yes, it'd be important for SSO however implementations of internal webapps using php is not that common in our experience. (Of course, I'm making a broad assumption that a company specializing in PowerApps / Dynamics 365 / CRM is most likely a .NET shop)

The most common scenario is an externally facing web site in WordPress, Drupal, Joomla that needs access to CDS / Dynamics 365 data. In this scenario S2S authentication is more appropriate. For example, we use the library in the upcoming version of the WordPress plugin (current version uses SOAP toolkit).

@amanjlucid
Copy link

I am getting the Message: Metadata request returned a 403 code while fetching record. Can you please suggest what am i missing ?
I am connecting with crm like below with my dynamic credentials -

$settings = new \AlexaCRM\WebAPI\OData\OnlineSettings();
$settings->instanceURI = 'https://contoso.crm.dynamics.com';
$settings->applicationID = '00000000-0000-0000-0000-000000000000';
$settings->applicationSecret = 'Application Secret';

$settings->tlsVerifyPeers = false;

$middleware = new \AlexaCRM\WebAPI\OData\OnlineAuthMiddleware( $settings );
$odataClient = new \AlexaCRM\WebAPI\OData\Client( $settings, $middleware );
$client = new \AlexaCRM\WebAPI\Client( $odataClient );

$retrievedContact = $client->Retrieve( 'account', '00000000-0000-0000-0000-000000000000', new \AlexaCRM\Xrm\ColumnSet( true ) );

@georged
Copy link
Contributor

georged commented Feb 10, 2021

@amanjlucid

  1. have you created an app user in Dataverse and granted that user a role?
  2. If yes then perhaps that role is insufficient to access the account record?

Otherwise I'd suggest wiring up logging to see more details about the error.

@CaptainCannabis
Copy link

@georged
Copy link
Contributor

georged commented Feb 12, 2021

Please start separate issues on the auth issues. This issue is about SSO in AD environments.

@georged georged mentioned this issue Sep 8, 2022
@georged georged added the wontfix This will not be worked on label Aug 13, 2024
@georged georged closed this as completed Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants