-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
112 additions
and
45 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
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
9 changes: 9 additions & 0 deletions
9
.../examples/generated/react-native/v12/LoginManager.snippet.api-key-login.tsx.rst
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 @@ | ||
.. code-block:: typescript | ||
const loginApiKeyUser = async (apiKey: ApiKey) => { | ||
try { | ||
logInWithApiKey(apiKey!.key); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}; |
3 changes: 3 additions & 0 deletions
3
...e/examples/generated/react-native/v12/Step1.snippet.create-user-api-key.tsx.rst
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,3 @@ | ||
.. code-block:: typescript | ||
const {_id, key, name, disabled} = await user?.apiKeys.create(apiKeyName); |
3 changes: 3 additions & 0 deletions
3
.../examples/generated/react-native/v12/Step1.snippet.user-api-key-imports.tsx.rst
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,3 @@ | ||
.. code-block:: typescript | ||
import {useUser} from '@realm/react'; |
11 changes: 11 additions & 0 deletions
11
source/examples/generated/react-native/v12/Step1.snippet.user-api-key.tsx.rst
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 @@ | ||
.. code-block:: typescript | ||
const user = useUser(); | ||
const createUserApiKey = async () => { | ||
const {_id, key, name, disabled} = await user?.apiKeys.create(apiKeyName); | ||
// ...Do something with API key like save it | ||
// or share it with external service that authenticates | ||
// on user's behalf. | ||
}; |
3 changes: 3 additions & 0 deletions
3
source/examples/generated/react-native/v12/Step2.snippet.api-key-delete.tsx.rst
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,3 @@ | ||
.. code-block:: typescript | ||
await user!.apiKeys.delete(cloudApiKey!._id); |
3 changes: 3 additions & 0 deletions
3
source/examples/generated/react-native/v12/Step2.snippet.api-key-disable.tsx.rst
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,3 @@ | ||
.. code-block:: typescript | ||
await user!.apiKeys.disable(cloudApiKey!._id); |
3 changes: 3 additions & 0 deletions
3
source/examples/generated/react-native/v12/Step2.snippet.api-key-enable.tsx.rst
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,3 @@ | ||
.. code-block:: typescript | ||
await user!.apiKeys.enable(cloudApiKey!._id); |
10 changes: 10 additions & 0 deletions
10
.../examples/generated/react-native/v12/Step2.snippet.look-up-user-api-key.tsx.rst
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,10 @@ | ||
.. code-block:: typescript | ||
const getUserApiKey = async () => { | ||
// List all of a user's keys | ||
const keys = await user.apiKeys.fetchAll(); | ||
// Get a specific key by its ID | ||
const key = await user!.apiKeys.fetch(apiKey!._id); | ||
setCloudApiKey(key); | ||
}; |
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