-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
73 additions
and
35 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
docs/sdk/native/swift/api-resources/_config-api-resources.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import ConfigApiResources from '../../../fragments/_config-api-resources.mdx'; | ||
|
||
import ConfigResourcesCode from './code/_config-resources-code.md'; | ||
import ConfigResourcesWithScopesCode from './code/_config-resources-with-scopes-code.md'; | ||
import ConfigResourcesWithSharedScopesCode from './code/_config-resources-with-shared-scopes-code.md'; | ||
|
||
<ConfigApiResources | ||
configResourcesCode={<ConfigResourcesCode />} | ||
configResourcesWithScopesCode={<ConfigResourcesWithScopesCode />} | ||
configResourcesWithSharedScopesCode={<ConfigResourcesWithSharedScopesCode />} | ||
/> |
8 changes: 8 additions & 0 deletions
8
docs/sdk/native/swift/api-resources/_fetch-access-token-for-api-resources.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import FetchAccessTokenForApiResources from '../../../fragments/_fetch-access-token-for-api-resources.mdx'; | ||
|
||
import GetAccessTokenCode from './code/_get-access-token-code.md'; | ||
|
||
<FetchAccessTokenForApiResources | ||
getAccessTokenApi="getAccessToken" | ||
getAccessTokenCode={<GetAccessTokenCode />} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ApiResourcesDescription from '../../../fragments/_api-resources-description.md'; | ||
|
||
import ConfigApiResources from './_config-api-resources.mdx'; | ||
import FetchAccessTokenForApiResources from './_fetch-access-token-for-api-resources.mdx'; | ||
|
||
<ApiResourcesDescription /> | ||
|
||
### Configure Logto client | ||
|
||
<ConfigApiResources /> | ||
|
||
### Fetch access token for the API resource | ||
|
||
<FetchAccessTokenForApiResources /> | ||
|
||
{/* Swift does not support organization tokens yet */} |
8 changes: 8 additions & 0 deletions
8
docs/sdk/native/swift/api-resources/code/_config-resources-code.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
```swift | ||
let config = try? LogtoConfig( | ||
endpoint: "<your-logto-endpoint>", // E.g. http://localhost:3001 | ||
appId: "<your-app-id>", | ||
resources: ["https://shopping.your-app.com/api", "https://store.your-app.com/api"], // Add API resources | ||
) | ||
let client = LogtoClient(useConfig: config) | ||
``` |
9 changes: 9 additions & 0 deletions
9
docs/sdk/native/swift/api-resources/code/_config-resources-with-scopes-code.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
```swift | ||
let config = try? LogtoConfig( | ||
endpoint: "<your-logto-endpoint>", | ||
appId: "<your-app-id>", | ||
scopes: ["shopping:read", "shopping:write", "store:read", "store:write"], | ||
resources: ["https://shopping.your-app.com/api", "https://store.your-app.com/api"], | ||
) | ||
let client = LogtoClient(useConfig: config) | ||
``` |
9 changes: 9 additions & 0 deletions
9
...dk/native/swift/api-resources/code/_config-resources-with-shared-scopes-code.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
```swift | ||
let config = try? LogtoConfig( | ||
endpoint: "<your-logto-endpoint>", | ||
appId: "<your-app-id>", | ||
scopes: ["read", "write"], | ||
resources: ["https://shopping.your-app.com/api", "https://store.your-app.com/api"], | ||
) | ||
let client = LogtoClient(useConfig: config) | ||
``` |
4 changes: 4 additions & 0 deletions
4
docs/sdk/native/swift/api-resources/code/_get-access-token-code.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
```swift | ||
let accessToken = try await client.getAccessToken(for: "https://shopping.your-app.com/api") | ||
// Custom logic | ||
``` |