npm

acheicorridas
TypeScript icon, indicating that this package has built-in type declarations

2.0.7 • Public • Published

AcheiCorridas Js SDK

const options = {
    applicationId: '<Your Application ID Here>',
    accessToken: '<Your Access Token Here>',
    baseURL: "https://api.acheicorridas.com.br/", // Production URL
    debug: true, // Enable debug
};
 
const AcheiCorridas = require('acheicorridas-sdk-js').default;
const acheiCorridas = new AcheiCorridas(options);
 
console.log(acheiCorridas.getAuthorizationUrl());
 
// Should print:
//      http://acheicorridas.dev/connect/signin?x-oauth=<Your Authorized Application ID>
// redirect your user to this page, and when it returns you will receive an access token via hash #accessToken=

Signin Popup in Browser

First include the js sdk for Browsers in your project, and then call

const options = {
    applicationId: '<Your Application ID Here>',
    accessToken: '<Your Access Token Here>',
    baseURL: "https://api.acheicorridas.com.br/", // Production URL
    debug: true, // Enable debug
};
 
// "AcheiCorridas" class comes from the included script js sdk for browser
const acheiCorridas = new AcheiCorridas(options);
 
function onSucessCallBack(user, accessToken){
    alert('Bem vindo ' + user.name);
}
 
function onErrorCallback(error, isCancelled) {
    console.error(error.message);
 
    // isCancelled is TRUE when user closes the popup without finishing the auth flow.
}
 
acheiCorridas.browserSignin(onSuccessCallback, onErrorCallback);

/acheicorridas/

    Package Sidebar

    Install

    npm i acheicorridas

    Weekly Downloads

    1

    Version

    2.0.7

    License

    ISC

    Unpacked Size

    234 kB

    Total Files

    36

    Last publish

    Collaborators

    • newestapps