You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 26, 2025. It is now read-only.
stale-issue-message: 'This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the `stale` label.'
17
+
stale-pr-message: 'This PR has been marked stale because there has been no activity within the last 28 days. To keep this PR active, remove the `stale` label.'
Run `composer require okta/sdk` from the root of your project in terminal, and you are done.
12
12
13
13
## Client Initialization
14
-
Once you have the SDK installed in your project, you will need to instantiate a Client object. We follow the builder
14
+
Once you have the SDK installed in your project, you will need to instantiate a Client object. We follow the builder
15
15
pattern for building a Client. You can create a Client by calling the ClientBuilder and relying on the ~/.okta/okta
16
-
.yaml file for the settings
16
+
.yaml file for the settings
17
17
18
18
```php
19
19
$client = (new \Okta\ClientBuilder())
20
20
->build();
21
21
```
22
22
23
23
By default, The client builder will look for a file in your home directory with the Okta properties you want to use.
24
-
This file should be placed at `~/.okta/okta.yaml`. If at this location, you do not need to define the location
25
-
during initialization. If you are unable to place the file there, or you are on a Windows based machine, you will
24
+
This file should be placed at `~/.okta/okta.yaml`. If at this location, you do not need to define the location
25
+
during initialization. If you are unable to place the file there, or you are on a Windows based machine, you will
26
26
have to define the location of this file manually if you want to use the file.
27
27
28
28
```php
@@ -31,7 +31,7 @@ $client = (new \Okta\ClientBuilder())
31
31
->build();
32
32
```
33
33
34
-
If you need to override any of the defaults from your `~/.okta/okta.yaml` file, or you do not have one, you can set
34
+
If you need to override any of the defaults from your `~/.okta/okta.yaml` file, or you do not have one, you can set
35
35
the properties on the client builder directly. The minimum required properties are your token and organization url.
36
36
37
37
```php
@@ -42,8 +42,8 @@ $client = (new \Okta\ClientBuilder())
42
42
```
43
43
44
44
### Changing your Http Client Instance
45
-
The Okta PHP SDK follows PSR-7 standards for HTTP Messages. We are using Httplug which allows you to change out to
46
-
any PSR-7 compliant Http Client. Create a new instance of a `Http\Client\HttpClient`
45
+
The Okta PHP SDK follows PSR-7 standards for HTTP Messages. We are using Httplug which allows you to change out to
46
+
any PSR-7 compliant Http Client. Create a new instance of a `Http\Client\HttpClient`
47
47
implementation and pass it into the client builder.
48
48
49
49
```php
@@ -52,6 +52,24 @@ $client = (new \Okta\ClientBuilder())
52
52
->build();
53
53
```
54
54
55
+
### OAuth 2.0
56
+
57
+
Okta allows you to interact with Okta APIs using scoped OAuth 2.0 access tokens. Each access token enables the bearer to perform specific actions on specific Okta endpoints, with that ability controlled by which scopes the access token contains.
58
+
59
+
This SDK supports this feature only for service-to-service applications. Check out [our guides](https://developer.okta.com/docs/guides/implement-oauth-for-okta-serviceapp/overview/) to learn more about how to register a new service application using a private and public key pair.
60
+
61
+
When using this approach you won't need an API Token because the SDK will request an access token for you. In order to use OAuth 2.0, construct a client instance by passing the following parameters:
0 commit comments