Authentication

Overview of authentication API methods

Credentials authentication

POST https://api.codemash.io/:version/auth/credentials

Authenticate a user using an email password pair. Also supports GET method with body parameters in a query string.

Path Parameters

Name
Type
Description

version

string

A version of the API endpoint.

Headers

Name
Type
Description

x-cm-projectid

string

Your project's ID. Can be passed as a query parameter.

Request Body

Name
Type
Description

password

string

User's login password.

userName

string

User's login e-mail address.

var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);

await membershipService.AuthenticateCredentialsAsync(
    "test@email.com", 
    "password123"
);

Microsoft authentication

POST https://api.codemash.io/{version}/auth/aad

Authenticate a user using Microsoft. Also supports GET method with body parameters in a query string.

Path Parameters

Name
Type
Description

version

string

A version of the API endpoint.

Headers

Name
Type
Description

x-cm-projectid

string

Your project's ID. Can be passed as a query parameter.

Request Body

Name
Type
Description

mode

string

Mode to use for authentication. If not passed, will use the default.

Logout

POST https://api.codemash.io/auth/logout

Logout a user using any of the authentication providers.

Path Parameters

Name
Type
Description

string

var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);

await membershipService.LogoutAsync("{BEARER_TOKEN}");

Check authentication

POST https://api.codemash.io/:version/auth

Check if the user is authenticated (if authorization token is valid). Also, supports GET method.

Path Parameters

Name
Type
Description

version

string

A version of the API endpoint.

Headers

Name
Type
Description

Authorization

string

Secret API key which belongs to your project or user. Not required if using cookies with a session ID.

x-cm-projectid

string

Your project's ID. Can be passed as a query parameter.

var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);

await membershipService.AuthenticateCredentialsAsync(
    "test@email.com", 
    "password123"
);

Last updated