Coder Social home page Coder Social logo

Comments (4)

vmurin avatar vmurin commented on July 24, 2024

Hi,

Nonce is a required part of request and response in OpenID Connect. See MS documentation here:

https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-openid-connect-code#send-the-sign-in-request

We can not remove it as it's a part of standard.

from react-native-azure-auth.

abdulrahman18 avatar abdulrahman18 commented on July 24, 2024

image

image

@vmurin I checked the response access token in jwt. But It shows an invalid signature. Can you help me?

from react-native-azure-auth.

abdulrahman18 avatar abdulrahman18 commented on July 24, 2024

@SahilRS200 Can you help me for jwt token issue. Are you fixed on this? I think your issue also same like this right?

from react-native-azure-auth.

vmurin avatar vmurin commented on July 24, 2024

Hi Abdulrahman

I have double checked your issue. I think your are using some wrong key/certificate to validate the token.
Take a look on MS documentation here
And then following article describing JWT.io usage.

As I can see from your screenshots you are using v1 of Azure access points. Your key ID (kid) is "HBxl9mAe6gxavCkcoOU2THsDNa0". And then in the screenshot with the keys I see the public key starting with "MIIBIjANBgk..." but the right key with this kid (from x5c prop) here https://login.microsoftonline.com/common/discovery/keys is "MIIDBTCCAe2gAwI..."

  1. So try to use the correct public key from the link above
  2. Enclose the key in appropriate header/footer like this
-----BEGIN CERTIFICATE-----
MIIDBTCCAe2gAwI.......
-----END CERTIFICATE-----
  1. Leave the private key field empty (it is not used for verification)

  2. Find a small code example that also worked for me below.

let jwt = require('jsonwebtoken');
let fs = require('fs');

const decodedValidToken = async (accessToken) => {
  const key = await fs.readFile('public.pem'); 
   
  return await jwt.verify(accessToken, key, function(err, decoded) {
        if (err) {
            console.log('ERROR:  ', err);
        }
        return decoded;
    });
  
}

const decodedToken = decodedValidToken('eyJ0eXAiOiJKV1QiLC.....PLACE YOUR DATE HERE or READ it with readFile e.g.')
    .then(decodedToken => console.log(decodedToken));

Good luck
Vladi

from react-native-azure-auth.

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.