Skip to content

Latest commit

 

History

History
202 lines (143 loc) · 5.04 KB

File metadata and controls

202 lines (143 loc) · 5.04 KB

AuthApi

All URIs are relative to https://api.medusa-commerce.com/store

Method HTTP request Description
deleteAuth DELETE /auth Customer Log out
getAuth GET /auth Get Current Customer
getAuthEmail GET /auth/{email} Check if email exists
postAuth POST /auth Customer Login

deleteAuth

deleteAuth()

Customer Log out

Destroys a Customer's authenticated session.

Example

// Import classes:
//import mobi.appcent.medusa.store.MedusaSdkClient;
//import mobi.appcent.medusa.store.ApiException;
//import mobi.appcent.medusa.store.Configuration;
//import mobi.appcent.medusa.store.auth.*;
//import api.mobi.appcent.medusa.store.AuthApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: cookie_auth
ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth");
cookie_auth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//cookie_auth.setApiKeyPrefix("Token");

AuthApi apiInstance = new AuthApi();
try {
    apiInstance.deleteAuth();
} catch (ApiException e) {
    System.err.println("Exception when calling AuthApi#deleteAuth");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

cookie_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

getAuth

StoreAuthRes getAuth()

Get Current Customer

Gets the currently logged in Customer.

Example

// Import classes:
//import mobi.appcent.medusa.store.MedusaSdkClient;
//import mobi.appcent.medusa.store.ApiException;
//import mobi.appcent.medusa.store.Configuration;
//import mobi.appcent.medusa.store.auth.*;
//import api.mobi.appcent.medusa.store.AuthApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: cookie_auth
ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth");
cookie_auth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//cookie_auth.setApiKeyPrefix("Token");

AuthApi apiInstance = new AuthApi();
try {
    StoreAuthRes result = apiInstance.getAuth();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling AuthApi#getAuth");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

StoreAuthRes

Authorization

cookie_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

getAuthEmail

StoreGetAuthEmailRes getAuthEmail(email)

Check if email exists

Checks if a Customer with the given email has signed up.

Example

// Import classes:
//import mobi.appcent.medusa.store.ApiException;
//import api.mobi.appcent.medusa.store.AuthApi;


AuthApi apiInstance = new AuthApi();
String email = "email_example"; // String | The email to check if exists.
try {
    StoreGetAuthEmailRes result = apiInstance.getAuthEmail(email);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling AuthApi#getAuthEmail");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
email String The email to check if exists.

Return type

StoreGetAuthEmailRes

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

postAuth

StoreAuthRes postAuth(body)

Customer Login

Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser.

Example

// Import classes:
//import mobi.appcent.medusa.store.ApiException;
//import api.mobi.appcent.medusa.store.AuthApi;


AuthApi apiInstance = new AuthApi();
StorePostAuthReq body = new StorePostAuthReq(); // StorePostAuthReq | 
try {
    StoreAuthRes result = apiInstance.postAuth(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling AuthApi#postAuth");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body StorePostAuthReq [optional]

Return type

StoreAuthRes

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, text/plain