-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from passageidentity/PSG-3181-gitbook-document…
…ation Add wrapper function docs
- Loading branch information
Showing
5 changed files
with
610 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Passage::AuthApi | ||
|
||
All URIs are relative to *https://api.passage.id/v1* | ||
|
||
| Method | HTTP request | Description | | ||
| ------ | ------------ | ----------- | | ||
| [**revoke_user_refresh_tokens**](TokensApi.md#revoke_user_refresh_tokens) | **DELETE** /apps/{app_id}/users/{user_id}/tokens | **Deprecated:** Revokes refresh tokens | | ||
| [**validate_jwt**](TokensApi.md#validate_jwt) | n/a | Validates jwt token | ||
|
||
|
||
## revoke_user_refresh_tokens | ||
|
||
> revoke_user_refresh_tokens(user_id) | ||
Revokes refresh tokens | ||
|
||
Revokes all refresh tokens for a user | ||
|
||
### Examples | ||
|
||
```ruby | ||
require 'passageidentity' | ||
|
||
class ApplicationController < ActionController::Base | ||
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) | ||
|
||
def revoke_passage_user_tokens! | ||
begin | ||
# tokens are revoked | ||
revoke = PassageClient.auth.revoke_user_refresh_tokens(USER_ID) | ||
rescue Exception => e | ||
# handle exception (user is not authorized) | ||
end | ||
end | ||
end | ||
``` | ||
|
||
|
||
### Parameters | ||
|
||
| Name | Type | Description | Notes | | ||
| ---- | ---- | ----------- | ----- | | ||
| **user_id** | **String** | User ID | | | ||
|
||
### Return type | ||
|
||
bool | ||
|
||
### Authorization | ||
|
||
[bearerAuth](../README.md#bearerAuth) | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: Not defined | ||
- **Accept**: application/json | ||
|
||
--- | ||
|
||
|
||
## validate_jwt | ||
|
||
> validate_jwt(token) | ||
Validates jwt token | ||
|
||
Validates jwt token for a user | ||
|
||
### Examples | ||
|
||
```ruby | ||
require 'passageidentity' | ||
|
||
class ApplicationController < ActionController::Base | ||
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) | ||
|
||
def validate_passage_user! | ||
begin | ||
# tokens are revoked | ||
revoke = PassageClient.auth.validate_jwt(token) | ||
rescue Exception => e | ||
# handle exception (user is not authorized) | ||
end | ||
end | ||
end | ||
``` | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | Notes | | ||
| ---- | ---- | ----------- | ----- | | ||
| **token** | **String** | jwt token | | | ||
|
||
### Return type | ||
|
||
[**UserInfo**](UserInfo.md) | ||
|
||
### Authorization | ||
|
||
[bearerAuth](../README.md#bearerAuth) | ||
|
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,107 @@ | ||
# Passage::ClientApi | ||
|
||
All URIs are relative to *https://api.passage.id/v1* | ||
|
||
| Method | HTTP request | Description | | ||
| ------ | ------------ | ----------- | | ||
| [**get_app**](ClientApi.md#get_app) | **GET** /apps/{app_id} | Get App | | ||
| [**create_magic_link**](ClientApi.md#create_magic_link) | **POST** /apps/{app_id}/magic-links | Create Embeddable Magic Link | | ||
|
||
|
||
## get_app | ||
|
||
> <AppResponse> get_app() | ||
Get App | ||
|
||
Get app information. | ||
|
||
### Examples | ||
|
||
```ruby | ||
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) | ||
|
||
begin | ||
# Get App | ||
result = PassageClient.get_app() | ||
p result | ||
rescue OpenapiClient::ApiError => e | ||
puts "Error when calling AppsApi->get_app: #{e}" | ||
end | ||
``` | ||
|
||
|
||
### Parameters | ||
|
||
| Name | Type | Description | Notes | | ||
| ---- | ---- | ----------- | ----- | | ||
| **app_id** | **String** | App ID | | | ||
|
||
### Return type | ||
|
||
[**AppResponse**](AppResponse.md) | ||
|
||
### Authorization | ||
|
||
[bearerAuth](../README.md#bearerAuth) | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: Not defined | ||
- **Accept**: application/json | ||
|
||
--- | ||
|
||
|
||
## create_magic_link | ||
|
||
> <MagicLinkResponse> create_magic_link(create_magic_link_request) | ||
Create Embeddable Magic Link | ||
|
||
Create magic link for a user. | ||
|
||
### Examples | ||
|
||
```ruby | ||
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) | ||
|
||
api_instance = PassageClient.create_magic_link() | ||
|
||
create_magic_link_request = OpenapiClient::create_magic_link({channel: OpenapiClient::MagicLinkChannel::EMAIL, email: 'email_example', magic_link_path: 'magic_link_path_example', phone: 'phone_example', redirect_url: 'redirect_url_example', _send: false, ttl: 37, user_id: 'user_id_example'}) # CreateMagicLinkRequest | magic link request | ||
|
||
begin | ||
# Create Embeddable Magic Link | ||
result = PassageClient.create_magic_link.create_magic_link(create_magic_link_request) | ||
p result | ||
rescue OpenapiClient::ApiError => e | ||
puts "Error when calling MagicLinksApi->create_magic_link: #{e}" | ||
end | ||
``` | ||
|
||
#### Using the create_magic_link_with_http_info variant | ||
|
||
This returns an Array which contains the response data, status code and headers. | ||
|
||
> <Array(<MagicLinkResponse>, Integer, Hash)> create_magic_link_with_http_info(app_id, create_magic_link_request) | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | Notes | | ||
| ---- | ---- | ----------- | ----- | | ||
| **create_magic_link_request** | [**CreateMagicLinkRequest**](CreateMagicLinkRequest.md) | magic link request | | | ||
|
||
### Return type | ||
|
||
[**MagicLinkResponse**](MagicLinkResponse.md) | ||
|
||
### Authorization | ||
|
||
[bearerAuth](../README.md#bearerAuth) | ||
|
||
### HTTP request headers | ||
|
||
- **Content-Type**: application/json | ||
- **Accept**: application/json | ||
|
Oops, something went wrong.