Giter Club home page Giter Club logo

Comments (23)

jostney avatar jostney commented on June 20, 2024

Sorry for asking it on flutter repo but i could not find proper place to ask it

from connectycube-flutter-samples.

TatankaConCube avatar TatankaConCube commented on June 20, 2024

according to the server documentation, the parameters for the generation of the signature should be placed in alphabetical order. it means when you add the user to the signature this parameter should be placed there in the alphabetical order too.

from connectycube-flutter-samples.

TatankaConCube avatar TatankaConCube commented on June 20, 2024

@jostney I meant the stringForSignature with the user should look next:

const stringForSignature = `application_id=${config.applicationId}&auth_key=${config.authKey}&nonce=${nonce}&timestamp=${timestamp}&user[email]=${emailAddress}&user[password]=${password}`;

from connectycube-flutter-samples.

jostney avatar jostney commented on June 20, 2024

In docs, the last two params(&user[email]=${emailAddress}&user[password]=${password}) did not mention.

By the way, i modifed stringForSignature as you did, still having same error when calling createSessionWithLogin

const getSignatureForUserSession = (emailAddress, password) => {
  const nonce = Math.floor(Math.random() * 1000000);
  const timestamp = Math.floor(Date.now() / 1000);
  const stringForSignature = `application_id=${config.applicationId}&auth_key=${config.authKey}&nonce=${nonce}&timestamp=${timestamp}&user[email]=${emailAddress}&user[password]=${password}`;
  const signature = crypto.createHmac('sha1', config.authSecret).update(stringForSignature).digest('hex');
  return { signature: signature, timestamp: timestamp, nonce: nonce };
}

const createSessionWithLogin = async (login, password) => {
  const signature = getSignatureForUserSession(login, password);
  
  const requestData = {
    'application_id': config.applicationId,
    'auth_key': config.authKey,
    'nonce': signature.nonce,
    'signature': signature.signature,
    'timestamp': signature.timestamp,
    "user": {
      "email": login,
      "password": password
    }
  };

  return await axios.post(
    'https://api.connectycube.com/session',
    requestData,
    {
      headers: {
        'Content-Type': 'application/json'
      }
    }
  );
};

from connectycube-flutter-samples.

TatankaConCube avatar TatankaConCube commented on June 20, 2024

In docs, the last two params(&user[email]=${emailAddress}&user[password]=${password}) did not mention.

the list of available parameters for session creation is provided in that doc at the table bottom

from connectycube-flutter-samples.

jostney avatar jostney commented on June 20, 2024

Who can assist me about this from back-end team ? In my latest answer i did all required things but still getting unexpected signature

from connectycube-flutter-samples.

TatankaConCube avatar TatankaConCube commented on June 20, 2024

@banshiAnton can assist here, I will ask him

from connectycube-flutter-samples.

banshiAnton avatar banshiAnton commented on June 20, 2024

Hi @jostney
Can you please send stringForSignature before and after hashing and requestData
Send this on our support email [email protected]
because this logs can contain sensitive account information

and double check your config (application_id/auth_key/auth_secret)

from connectycube-flutter-samples.

jostney avatar jostney commented on June 20, 2024

Sent it, waiting. Thanks

from connectycube-flutter-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.