-
Notifications
You must be signed in to change notification settings - Fork 3
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
74 changed files
with
51 additions
and
2,335 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# @kinde-oss/react-native-sdk | ||
# @kinde-oss/react-native-sdk-0-6x | ||
|
||
React Native Client for `@kinde-oss/react-native-sdk` | ||
React Native Client for `@kinde-oss/react-native-sdk-0-6x` | ||
Provides endpoints to manage your Kinde Businesses | ||
|
||
> Functions/methods targeting the Management API can only be accessed with tokens generated by the Client Credentials Auth flow at the moment. Since this SDK does not support the Client Credential flow, Management API functions are not available for use. In the future, tokens obtained via other flows would also be able to access the management API functions/methods. | ||
|
@@ -24,7 +24,7 @@ Follow [the installation instructions for your chosen OS](https://reactnative.de | |
The SDK can be installed with `npm` or `yarn` but we will use `npm` for code samples. | ||
|
||
```shell | ||
npm install @kinde-oss/react-native-sdk --save | ||
npm install @kinde-oss/react-native-sdk-0-6x --save | ||
``` | ||
|
||
### Android | ||
|
@@ -302,7 +302,7 @@ You’ll need to create a new instance of the Kinde Auth client object. Please e | |
|
||
```javascript | ||
... | ||
import { KindeSDK } from '@kinde-oss/react-native-sdk'; | ||
import { KindeSDK } from '@kinde-oss/react-native-sdk-0-6x'; | ||
... | ||
|
||
... | ||
|
@@ -456,23 +456,12 @@ const handleLogout = () => { | |
|
||
### Get user information | ||
|
||
**\*Note warning:** Before you call the API, please make sure that you've already authenticated. If not, errors will appear there.\* | ||
|
||
To access the user information, use the `OAuthApi`, `ApiClient` classes exported from `@kinde-oss/react-native-sdk`, then call the `getUser` method of `OAuthApi` instance | ||
To access the user information, use the `getUserDetails` helper function: | ||
|
||
```javascript | ||
... | ||
import { ..., OAuthApi, ApiClient, ... } from '@kinde-oss/react-native-sdk'; | ||
... | ||
|
||
const getUserProfile = () => { | ||
const config = new ApiClient.Configuration({ | ||
basePath: KINDE_ISSUER_URL, | ||
}); | ||
const apiInstance = new OAuthApi(config) | ||
const data = await apiInstance.getUser(); | ||
console.log('API called successfully. Returned data: ' + data); | ||
} | ||
const userProfile = await client.getUserDetails(); | ||
console.log(userProfile); | ||
// output: {"given_name":"Dave","id":"abcdef","family_name":"Smith","email":"[email protected]"} | ||
``` | ||
|
||
### View users in Kinde | ||
|
@@ -650,7 +639,7 @@ E.g., using the `getAccessToken` method of `the Storage` class to get an access | |
|
||
```javascript | ||
... | ||
import Storage from '@kinde-oss/react-native-sdk' | ||
import Storage from '@kinde-oss/react-native-sdk-0-6x' | ||
... | ||
|
||
|
||
|
@@ -737,39 +726,3 @@ rm -rf Pods && rm Podfile.lock | |
3. Clean build folders on Xcode. | ||
|
||
If you need any assistance with getting Kinde connected reach out to us at [email protected]. | ||
|
||
## How to run test | ||
|
||
The simplest way to run the JavaScript test suite is by using the following command at the root of your React Native checkout: | ||
|
||
```bash | ||
npm run test | ||
|
||
// or | ||
yarn test | ||
``` | ||
|
||
## Documentation for API Endpoints | ||
|
||
All URIs are relative to *https://your_kinde_domain.kinde.com/api/v1* | ||
|
||
| Class | Method | HTTP request | Description | | ||
| -------------------------------------- | --------------------------------------------------------- | ------------------------------- | ----------------------------------------------------------- | | ||
| _@kinde-oss/react-native-sdk.OAuthApi_ | [**getUser**](docs/OAuthApi.md#getUser) | **GET** /oauth2/user_profile | Returns the details of the currently logged in user | | ||
| _@kinde-oss/react-native-sdk.OAuthApi_ | [**getUserProfileV2**](docs/OAuthApi.md#getUserProfileV2) | **GET** /oauth2/v2/user_profile | Returns the details of the currently logged in user | | ||
| _@kinde-oss/react-native-sdk.UsersApi_ | [**createUser**](docs/UsersApi.md#createUser) | **POST** /user | Creates a user record | | ||
| _@kinde-oss/react-native-sdk.UsersApi_ | [**getUsers**](docs/UsersApi.md#getUsers) | **GET** /users | Returns a paginated list of end-user records for a business | | ||
|
||
## Documentation for Models | ||
|
||
- [@kinde-oss/react-native-sdk.CreateUser200Response](docs/CreateUser200Response.md) | ||
- [@kinde-oss/react-native-sdk.CreateUserRequest](docs/CreateUserRequest.md) | ||
- [@kinde-oss/react-native-sdk.CreateUserRequestIdentitiesInner](docs/CreateUserRequestIdentitiesInner.md) | ||
- [@kinde-oss/react-native-sdk.CreateUserRequestIdentitiesInnerDetails](docs/CreateUserRequestIdentitiesInnerDetails.md) | ||
- [@kinde-oss/react-native-sdk.CreateUserRequestProfile](docs/CreateUserRequestProfile.md) | ||
- [@kinde-oss/react-native-sdk.GetUsers200Response](docs/GetUsers200Response.md) | ||
- [@kinde-oss/react-native-sdk.User](docs/User.md) | ||
- [@kinde-oss/react-native-sdk.UserIdentity](docs/UserIdentity.md) | ||
- [@kinde-oss/react-native-sdk.UserIdentityResult](docs/UserIdentityResult.md) | ||
- [@kinde-oss/react-native-sdk.UserProfile](docs/UserProfile.md) | ||
- [@kinde-oss/react-native-sdk.UserProfileV2](docs/UserProfileV2.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// @ts-nocheck | ||
|
||
const { KindeSDK, ApiClient, OAuthApi } = require(process.cwd() + '/src/index'); | ||
const { KindeSDK } = require(process.cwd() + '/src/index'); | ||
import jwtDecode from 'jwt-decode'; | ||
import Url from 'url-parse'; | ||
import RNStorage from '../src/SDK/Storage/RNStorage'; | ||
|
@@ -63,19 +63,12 @@ const configuration = { | |
fakeCodeChallenge: '3Aqg8_tu8aNwnxPmhE1b1ONsThy-b6hppET0knva9Kc' | ||
}; | ||
|
||
const fakeUserProfile = { | ||
id: 'kp:58ece9f68a7c4c098efc1cf45c774e16', | ||
last_name: 'test', | ||
first_name: 'user', | ||
provided_id: null, | ||
preferred_email: '[email protected]' | ||
}; | ||
|
||
const fakeUserDetail = { | ||
id: 'kp:58ece9f68a7c4c098efc1cf45c774e16', | ||
given_name: 'test', | ||
family_name: 'user', | ||
email: '[email protected]' | ||
email: '[email protected]', | ||
picture: '' | ||
}; | ||
|
||
const fakePayloadFromDecodeToken = { | ||
|
@@ -405,28 +398,6 @@ describe('KindeSDK', () => { | |
}); | ||
}); | ||
|
||
describe('Api', () => { | ||
test('Get user profile', async () => { | ||
const config = new ApiClient.Configuration({ | ||
basePath: configuration.issuer | ||
}); | ||
const apiInstance = new OAuthApi(config); | ||
jest.spyOn(apiInstance, 'getUserProfileV2').mockImplementation( | ||
() => { | ||
return { | ||
id: 'kp:58ece9f68a7c4c098efc1cf45c774e16', | ||
last_name: 'test', | ||
first_name: 'user', | ||
provided_id: null, | ||
preferred_email: '[email protected]' | ||
}; | ||
} | ||
); | ||
const data = await apiInstance.getUserProfileV2(); | ||
await expect(data).toEqual(fakeUserProfile); | ||
}); | ||
}); | ||
|
||
describe('Payload', () => { | ||
test('[RNStorage] Get claim via access token', async () => { | ||
RNStorage.prototype.getItem = jest.fn().mockReturnValue({ | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "@kinde-oss/react-native-sdk", | ||
"displayName": "@kinde-oss/react-native-sdk" | ||
"name": "@kinde-oss/react-native-sdk-0-6x", | ||
"displayName": "@kinde-oss/react-native-sdk-0-6x" | ||
} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Oops, something went wrong.