User Authentication

In the user access section you can configure the integration of Auth0 to your project to give security to your application or website

Setup

  1. Create an Auth 0 account

  2. Create an app

  3. Setup your tenant

  4. On auth0 navigate to your tenant and go to actions, copy the next code using your project_id

const axios = require('axios').default;

const accessKeyId = 'ACCESSKEYID' // Your access key id provide by App Uncodie.
const accessKeySecret = 'ACCESSKEYSECRET' // Your access key secret provide by App Uncodie.

/
function that store user on project database.
*
@param {object} user - The user being created
*/
const addUser = async (user)=>{
  const project_id = 709 // Id of the project where you want to store the new user, You can obtain it from the route in the URL by selecting your project within the App.
  return axios({
    method: 'post',
    url: 'https://dev.api.uncodie.com/project/create/user',
    headers: {
      "Content-Type": "application/json",
      "accessKeyId": accessKeyId,
      "accessKeySecret": accessKeySecret
    },
    data: {
      "project_id": project_id,
      "email": user.email,
      "name": user.given_name ? user.given_name : user.email,
      "image_url": user.picture,
      "collection": "users" // Collection where users are stored. 'users' is provided by Uncodie, if you have another one, replace it with that.
    }
  })

This code will use the register user API endpoint to add a new user to your data base, for more information see:

Register User
  1. Setup your credentials in Uncodie as follows:

Domain

This data is the domain assigned to your app in Auth0, this can be your tenant's auth0 subdomain, or your own CNAME for the external login and authentication, for example:

login.yourdomain.com

Client ID

This data is the client ID assigned by Auth0 to your app in Auth0

Secret

This data is the secret assigned by Auth0 to your app in Auth0

Machine 2 Machine autentication

Use the Auth0 environment variables to grant access to your backend to your auth0 tenant´s information.

Setup

  1. Set your auth0 basic configuration

  2. Navigate to app.uncodie.com and select your project

  3. Inside your Environment Variables add the next Key Pairs:

Environment variables

To update user data it is necessary to configure the following parameters

SERVER_AUTH0_DOMAIN

SERVER_AUTH0_CLIENT_ID

SERVER_AUTH0_CLIENT_SECRET

For more information and documentation for Auth0 also check:

Last updated

Was this helpful?