0
votes

So I am using azure ad-b2c with OpenId Connect. So far I have an angularjs app and everything is set up on AD B2C

I have successfully requested and id_token and code, I am now trying to redeem this authorization code for an access_token as per https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-reference-oidc#get-a-token

postData = {
             grant_type: 'authorization_code',
             client_id: '<client_id>',
             code: data.code,
             redirect_uri: 'https://localhost:3000/',
             client_secret: '<client-secret>'
           };
 this.$http.post('https://login.microsoftonline.com/<myapp>/oauth2/v2.0/token?p=B2C_1_SiUpIn', postData)
                    .then((result: any) => {
                        console.log(result);
                    });

The above code shows how I am making the post request. (I've stripped out the confidential parts)

When I check the chrome console I see Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:3000' is therefore not allowed access.

Is it possible to turn this off for Azure AD B2C or am I doing something wrong when posting the request.

Any suggestions are welcome.

Thanks

1

1 Answers

0
votes

For the record in the end I found out I did not need to request an access token when using the implicit flow.